PHP 8.3.31
Preview: DatabaseServiceProvider.php Size: 3.19 KB
/home/getspomw/royalsquad.us/vendor/laravel/framework/src/Illuminate/Database/DatabaseServiceProvider.php

<?php

namespace Illuminate\Database;

use Faker\Factory as FakerFactory;
use Faker\Generator as FakerGenerator;
use Illuminate\Contracts\Queue\EntityResolver;
use Illuminate\Database\Connectors\ConnectionFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\QueueEntityResolver;
use Illuminate\Support\ServiceProvider;

class DatabaseServiceProvider extends ServiceProvider
{
    /**
     * The array of resolved Faker instances.
     *
     * @var array
     */
    protected static $fakers = [];

    /**
     * Bootstrap the application events.
     *
     * @return void
     */
    public function boot()
    {
        Model::setConnectionResolver($this->app['db']);

        Model::setEventDispatcher($this->app['events']);
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        Model::clearBootedModels();

        $this->registerConnectionServices();
        $this->registerFakerGenerator();
        $this->registerQueueableEntityResolver();
    }

    /**
     * Register the primary database bindings.
     *
     * @return void
     */
    protected function registerConnectionServices()
    {
        // The connection factory is used to create the actual connection instances on
        // the database. We will inject the factory into the manager so that it may
        // make the connections while they are actually needed and not of before.
        $this->app->singleton('db.factory', function ($app) {
            return new ConnectionFactory($app);
        });

        // The database manager is used to resolve various connections, since multiple
        // connections might be managed. It also implements the connection resolver
        // interface which may be used by other components requiring connections.
        $this->app->singleton('db', function ($app) {
            return new DatabaseManager($app, $app['db.factory']);
        });

        $this->app->bind('db.connection', function ($app) {
            return $app['db']->connection();
        });

        $this->app->bind('db.schema', function ($app) {
            return $app['db']->connection()->getSchemaBuilder();
        });

        $this->app->singleton('db.transactions', function ($app) {
            return new DatabaseTransactionsManager;
        });
    }

    /**
     * Register the Faker Generator instance in the container.
     *
     * @return void
     */
    protected function registerFakerGenerator()
    {
        $this->app->singleton(FakerGenerator::class, function ($app, $parameters) {
            $locale = $parameters['locale'] ?? $app['config']->get('app.faker_locale', 'en_US');

            if (! isset(static::$fakers[$locale])) {
                static::$fakers[$locale] = FakerFactory::create($locale);
            }

            static::$fakers[$locale]->unique(true);

            return static::$fakers[$locale];
        });
    }

    /**
     * Register the queueable entity resolver implementation.
     *
     * @return void
     */
    protected function registerQueueableEntityResolver()
    {
        $this->app->singleton(EntityResolver::class, function () {
            return new QueueEntityResolver;
        });
    }
}

Directory Contents

Dirs: 9 × Files: 33

Name Size Perms Modified Actions
Capsule DIR
- drwxrwxrwx 2025-09-17 06:53:01
Edit Download
Concerns DIR
- drwxrwxrwx 2025-09-17 06:53:01
Edit Download
- drwxrwxrwx 2025-09-17 06:53:00
Edit Download
Console DIR
- drwxrwxrwx 2025-09-17 06:53:01
Edit Download
Eloquent DIR
- drwxrwxrwx 2025-09-17 06:53:01
Edit Download
Events DIR
- drwxrwxrwx 2025-09-17 06:53:01
Edit Download
- drwxrwxrwx 2025-09-17 06:53:00
Edit Download
Query DIR
- drwxrwxrwx 2025-09-17 06:53:01
Edit Download
Schema DIR
- drwxrwxrwx 2025-09-17 06:53:00
Edit Download
525 B lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
1.67 KB lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
192 B lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
41.76 KB lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
4.16 KB lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
1.95 KB lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
575 B lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
13.52 KB lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
3.19 KB lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
1.58 KB lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
7.75 KB lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
114 B lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
1.09 KB lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
4.26 KB lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
7.89 KB lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
769 B lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
1.05 KB lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
124 B lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
2.53 KB lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
6.08 KB lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
137 B lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
745 B lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
4.39 KB lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
2.90 KB lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
2.08 KB lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
2.16 KB lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
128 B lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
129 B lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
4.63 KB lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
5.53 KB lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
565 B lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
3.98 KB lrw-rw-rw- 2025-09-17 06:53:00
Edit Download
107 B lrw-rw-rw- 2025-09-17 06:53:00
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).