bootModelRepositoryTrait

@return  void
167072
public function bootDatabaseRepositoryTrait()
    {
        $this->table      = property_exists($this, 'table') ? $this->table : null;
        $this->keys       = property_exists($this, 'keys') ? $this->keys : null;
        $this->record     = property_exists($this, 'record') ? $this->record : null;
        $this->dataMapper = property_exists($this, 'dataMapper') ? $this->dataMapper : null;
    }
120130
public function boot()
    {
        $this->publishes([
            $this->basepath . "config" . DIRECTORY_SEPARATOR . self::CONFIG_FILENAME . ".php" => config_path(self::CONFIG_FILENAME . '.php'),
            $this->basepath . "config" . DIRECTORY_SEPARATOR . self::DUMMY_ADJUSTMENT_FILENAME => config_path(self::MODEL_ADJUSTMENTS_FOLDERNAME . DIRECTORY_SEPARATOR . self::DUMMY_ADJUSTMENT_FILENAME)
        ]);
        
        if ($this->app->runningInConsole()) {
            $this->commands([
                InstallCommand::class,
                GenerateCommand::class
            ]);
        }
    }
664226
protected function registerRevisionRepository()
    {
        $this->app->singleton('revisionrepository', function ($app) {
            $model = $app['config']['credentials.revision'];
            $revision = new $model();

            $validator = $app['validator'];

            return new RevisionRepository($revision, $validator);
        });

        $this->app->alias('revisionrepository', RevisionRepository::class);
    }
1065155
public static function bootUuidBinaryModelTrait()
    {
        static::creating(function ($model) {
            // Only generate UUID if it wasn't set by already.
            $key = $model->getKeyName();
            if (!isset($model->attributes[$key])) {
                // This is necessary because on \Illuminate\Database\Eloquent\Model::performInsert
                // will not check for $this->getIncrementing() but directly for $this->incrementing
                $model->incrementing = false;
                $uuidVersion = (!empty($model->uuidVersion) ? $model->uuidVersion : 4);   // defaults to 4
                $uuid = Uuid::generate($uuidVersion);
                $model->attributes[$key] = (property_exists($model, 'uuidOptimization') && $model::$uuidOptimization ? $model::toOptimized($uuid->string) : $uuid->bytes);
            }
        }, 0);
    }
722135
public function bootstrap()
    {

        // setup autoloader
        require SERVER_AUTOLOADER;

        // make the application available and register the class loaders
        $application = $this->getApplication();
        $application->registerClassLoaders();

        // register the applications annotation registries
        $application->registerAnnotationRegistries();

        // try to load the profile logger
        if (isset($this->loggers[LoggerUtils::PROFILE])) {
            $this->profileLogger = $this->loggers[LoggerUtils::PROFILE];
            $this->profileLogger->appendThreadContext('timer-factory');
        }
    }
588427
public function boot ()
    {

        // Lang
        $this->loadTranslationsFrom(__DIR__ . '/Lang/' , 'Categories');

        //migrations
        $this->loadMigrationsFrom(__DIR__ . '/Database/Migrations');

        //bind
        $this->app->bind('CategoriesClass' , function () {
            return new Repository();
        });

    }
285444
public static function bootLaratrustUserTrait()
    {
        $flushCache = function ($user) {
            $user->flushCache();
        };

        // If the user doesn't use SoftDeletes.
        if (method_exists(static::class, 'restored')) {
            static::restored($flushCache);
        }

        static::deleted($flushCache);
        static::saved($flushCache);

        static::deleting(function ($user) {
            if (method_exists($user, 'bootSoftDeletes') && !$user->forceDeleting) {
                return;
            }

            $user->roles()->sync([]);
            $user->permissions()->sync([]);
        });
    }
607221
public function boot()
    {
        $path = realpath(__DIR__ . '/../resources');
        $this->addConfigComponent('antares/memory', 'antares/memory', $path . '/config');
        if (!$this->hasPackageRepository()) {
            $this->bootUnderLaravel($path);
        }
        $this->bootMemoryEvent();
        Model\Permission::observe(new Observer\PermissionObserver());
        \Antares\Model\UserRole::observe(new Observer\PermissionObserver());
        \Antares\Model\Role::observe(new Observer\PermissionObserver());
        \Antares\Model\Action::observe(new Observer\PermissionObserver());
    }
375714
public function boot()
    {
        if ($this->isLumen() === false) {
            $this->publishes([
                __DIR__ . '/../../config/hashids.php' => config_path('hashids.php'),
            ]);

            // Add 'Assets' facade alias
            AliasLoader::getInstance()->alias('Hashids', 'Torann\Hashids\Facade');
        }
    }
1366936
protected static function boot(): void
    {
        parent::boot();

        /**
         * Attach to the 'creating' Model Event to provide a UUID
         * for the `id` field (provided by $model->getKeyName())
         */
        static::creating(function ($model) {
            if (!isset($model->attributes['id'])) {
                $model->attributes['id'] = Uuid::uuid4()->toString();
            }

            /** @var HCUuidModel $model */
            $model->{$model->getKeyName()} = $model->attributes['id'];
        });
    }
359762
public function boot()
    {
        // Load configs files and publish them
        $path = __DIR__ . '/../../config';
        $this->loadYamlFrom($path, $this->namespace, $this->publish);

        // Load more configs and aliases
        parent::boot();
    }
953637
public function boot()
    {
        parent::boot();

        $this->publishConfig();
        $this->publishFactories();

        Auth::$runsMigrations ? $this->loadMigrations() : $this->publishMigrations();
    }
1226985
public function boot()
    {
        Cache::extend('redis', function ($app, $config) {
            $store = new RedisStore(
                $app['redis'],
                Arr::get($config, 'prefix', $this->app['config']['cache.prefix']),
                Arr::get($config, 'connection', 'default')
            );

            $repository = new Repository($store);

            if ($app->bound('Illuminate\Contracts\Events\Dispatcher')) {
                $repository->setEventDispatcher(
                    $app['Illuminate\Contracts\Events\Dispatcher']
                );
            }

            return $repository;
        });
    }
667392
public function bootstrap()
    {

        // setup autoloader
        require SERVER_AUTOLOADER;

        // register the application's class loaders
        $application = $this->getApplication();
        $application->registerClassLoaders();

        // register the applications annotation registries
        $application->registerAnnotationRegistries();

        // try to load the system logger
        $this->systemLogger = $this->getLogger(LoggerUtils::SYSTEM);

        // try to load the profile logger
        if ($this->profileLogger = $this->getLogger(LoggerUtils::PROFILE)) {
            $this->profileLogger->appendThreadContext('servlet-engine-garbage-collector');
        }
    }
701731
public function boot()
    {
        $this->publishes([
            dirname(dirname(__DIR__)).'/config/repositories.php' => config_path('repositories.php'),
        ]);

        foreach (config('repositories.repositories', []) as $respository_contract => $repository) {
            $this->app->bind($respository_contract, $repository);
        }

        foreach (config('repositories.repository_transformers', []) as $transformer_contract => $transformer) {
            $this->app->bind($transformer, $transformer);
        }

        foreach (config('repositories.repository_transformers', []) as $repository_class => $transformer) {
            $this->app->when($repository_class)
                ->needs(TransformerContract::class)
                ->give(function () use ($transformer) {
                    return $this->app->make($transformer);
                });
        }

        foreach (config('repositories.contextual_repositories', []) as $controller => $repository) {
            $this->app->when($controller)
              ->needs(RepositoryContract::class)
              ->give($repository);
        }

        $this->commands([
            \CroudTech\Repositories\Console\Commands\CreateRepository::class,
        ]);
    }
1141441
public static function bootEntrustUserTrait()
    {
        $flushCache = function () {
            if (Cache::getStore() instanceof TaggableStore) {
                Cache::tags(Config::get('entrust.permission_role_table'))->flush();
            }
        };

        static::restored($flushCache);
        static::deleted($flushCache);
        static::saved($flushCache);

        static::deleting(function ($user) {
            if (! method_exists(Config::get('auth.model'), 'bootSoftDeletes')) {
                $user->roles()->sync([]);
            }

            return true;
        });
    }
1091675
public function boot()
    {

        if ($this->booted) {
            return;
        }

        /** @var \Songshenzong\Log\LaravelDebugbar $debugbar */
        $debugbar = $this;

        /** @var Application $app */
        $app = $this->app;

        // Set custom error handler
        set_error_handler([$this, 'handleError']);

        /**---------------------------------------------------------
         *   phpinfo
         *---------------------------------------------------------*/
        if ($this->shouldCollect('phpinfo', true)) {
            $this->addCollector(new PhpInfoCollector());
        }


        /**---------------------------------------------------------
         *   Messages
         *---------------------------------------------------------*/
        if ($this->shouldCollect('messages', true)) {
            $this->addCollector(new MessagesCollector());
        }


        /**---------------------------------------------------------
         *   time
         *---------------------------------------------------------*/
        if ($this->shouldCollect('time', true)) {
            $this->addCollector(new TimeDataCollector());

            if (!$this->isLumen()) {
                $this->app->booted(
                    function () use ($debugbar) {
                        $startTime = $this->app['request']->server('REQUEST_TIME_FLOAT');
                        if ($startTime) {
                            $debugbar['time']->addMeasure('Booting', $startTime, microtime(true));
                        }
                    }
                );
            }

            $debugbar->startMeasure('application', 'Application');
        }


        /**---------------------------------------------------------
         *   memory
         *---------------------------------------------------------*/
        if ($this->shouldCollect('memory', true)) {
            $this->addCollector(new MemoryCollector());
        }

        /**---------------------------------------------------------
         *   exceptions
         *---------------------------------------------------------*/
        if ($this->shouldCollect('exceptions', true)) {
            try {
                $exceptionCollector = new ExceptionsCollector();
                $exceptionCollector->setChainExceptions(
                    $this->app['config']->get('songshenzong-log.options.exceptions.chain', true)
                );
                $this->addCollector($exceptionCollector);
            } catch (\Exception $e) {
            }
        }

        /**---------------------------------------------------------
         *   laravel
         *---------------------------------------------------------*/
        if ($this->shouldCollect('laravel', false)) {
            $this->addCollector(new LaravelCollector($this->app));
        }


        /**---------------------------------------------------------
         *   All events fired
         *---------------------------------------------------------*/
        if ($this->shouldCollect('events', false) && isset($this->app['events'])) {
            try {
                $startTime      = $this->app['request']->server('REQUEST_TIME_FLOAT');
                $eventCollector = new EventCollector($startTime);
                $this->addCollector($eventCollector);
                $this->app['events']->subscribe($eventCollector);
            } catch (\Exception $e) {
                $this->addThrowable(
                    new Exception(
                        'Cannot add EventCollector to SongshenzongLog: ' . $e->getMessage(),
                        $e->getCode(),
                        $e
                    )
                );
            }
        }

        /**---------------------------------------------------------
         *   Views with their data
         *---------------------------------------------------------*/
        if ($this->shouldCollect('views', true) && isset($this->app['events'])) {
            try {
                $collectData = $this->app['config']->get('songshenzong-log.options.views.data', true);
                $this->addCollector(new ViewCollector($collectData));
                $this->app['events']->listen(
                    'composing:*',
                    function ($view, $data = []) use ($debugbar) {
                        if ($data) {
                            $view = $data[0]; // For Laravel >= 5.4
                        }
                        $debugbar['views']->addView($view);
                    }
                );
            } catch (\Exception $e) {
                $this->addThrowable(
                    new Exception(
                        'Cannot add ViewCollector to SongshenzongLog: ' . $e->getMessage(),
                        $e->getCode(),
                        $e
                    )
                );
            }
        }


        /**---------------------------------------------------------
         *   Current route information
         *---------------------------------------------------------*/
        if (!$this->isLumen() && $this->shouldCollect('route')) {
            try {
                $this->addCollector($this->app->make('Songshenzong\Log\DataCollector\IlluminateRouteCollector'));
            } catch (\Exception $e) {
                $this->addThrowable(
                    new Exception(
                        'Cannot add RouteCollector to SongshenzongLog: ' . $e->getMessage(),
                        $e->getCode(),
                        $e
                    )
                );
            }
        }


        /**---------------------------------------------------------
         *   Logs from Mongolog (merged in messages if enabled)
         *---------------------------------------------------------*/
        if (!$this->isLumen() && $this->shouldCollect('log', true)) {
            try {
                if ($this->hasCollector('messages')) {
                    $logger = new MessagesCollector('log');
                    $this['messages']->aggregate($logger);
                    $this->app['log']->listen(
                        function ($level, $message = null, $context = null) use ($logger) {
                            // Laravel 5.4 changed how the global log listeners are called. We must account for
                            // the first argument being an "event object", where arguments are passed
                            // via object properties, instead of individual arguments.
                            if ($level instanceof \Illuminate\Log\Events\MessageLogged) {
                                $message = $level->message;
                                $context = $level->context;
                                $level   = $level->level;
                            }

                            try {
                                $logMessage = (string) $message;
                                if (mb_check_encoding($logMessage, 'UTF-8')) {
                                    $logMessage .= (!empty($context) ? ' ' . json_encode($context) : '');
                                } else {
                                    $logMessage = '[INVALID UTF-8 DATA]';
                                }
                            } catch (\Exception $e) {
                                $logMessage = '[Exception: ' . $e->getMessage() . ']';
                            }
                            $logger->addMessage(
                                '[' . date('H:i:s') . '] ' . "LOG.$level: " . $logMessage,
                                $level,
                                false
                            );
                        }
                    );
                } else {
                    $this->addCollector(new MonologCollector($this->app['log']->getMonolog()));
                }
            } catch (\Exception $e) {
                $this->addThrowable(
                    new Exception(
                        'Cannot add LogsCollector to SongshenzongLog: ' . $e->getMessage(),
                        $e->getCode(),
                        $e
                    )
                );
            }
        }


        /**---------------------------------------------------------
         *   Show database (PDO) queries and bindings
         *---------------------------------------------------------*/
        if ($this->shouldCollect('db', true) && isset($this->app['db'])) {
            $db = $this->app['db'];
            if ($debugbar->hasCollector('time') && $this->app['config']->get(
                    'songshenzong-log.options.db.timeline',
                    false
                )
            ) {
                $timeCollector = $debugbar->getCollector('time');
            } else {
                $timeCollector = null;
            }
            $queryCollector = new QueryCollector($timeCollector);

            $queryCollector->setDataFormatter(new QueryFormatter());

            if ($this->app['config']->get('songshenzong-log.options.db.with_params')) {
                $queryCollector->setRenderSqlWithParams(true);
            }

            if ($this->app['config']->get('songshenzong-log.options.db.backtrace')) {
                $middleware = !$this->is_lumen ? $this->app['router']->getMiddleware() : [];
                $queryCollector->setFindSource(true, $middleware);
            }

            if ($this->app['config']->get('songshenzong-log.options.db.explain.enabled')) {
                $types = $this->app['config']->get('songshenzong-log.options.db.explain.types');
                $queryCollector->setExplainSource(true, $types);
            }

            if ($this->app['config']->get('songshenzong-log.options.db.hints', true)) {
                $queryCollector->setShowHints(true);
            }

            $this->addCollector($queryCollector);

            try {
                $db->listen(
                    function ($query, $bindings = null, $time = null, $connectionName = null) use ($db, $queryCollector) {
                        // Laravel 5.2 changed the way some core events worked. We must account for
                        // the first argument being an "event object", where arguments are passed
                        // via object properties, instead of individual arguments.
                        if ($query instanceof \Illuminate\Database\Events\QueryExecuted) {
                            $bindings   = $query->bindings;
                            $time       = $query->time;
                            $connection = $query->connection;

                            $query = $query->sql;
                        } else {
                            $connection = $db->connection($connectionName);
                        }

                        $queryCollector->addQuery((string) $query, $bindings, $time, $connection);
                    }
                );
            } catch (\Exception $e) {
                $this->addThrowable(
                    new Exception(
                        'Cannot add listen to Queries for Songshenzong: ' . $e->getMessage(),
                        $e->getCode(),
                        $e
                    )
                );
            }

            try {
                $db->getEventDispatcher()->listen([
                                                      \Illuminate\Database\Events\TransactionBeginning::class,
                                                      'connection.*.beganTransaction',
                                                  ], function ($transaction) use ($queryCollector) {
                    $queryCollector->collectTransactionEvent('Begin Transaction', $transaction->connection);
                });

                $db->getEventDispatcher()->listen([
                                                      \Illuminate\Database\Events\TransactionCommitted::class,
                                                      'connection.*.committed',
                                                  ], function ($transaction) use ($queryCollector) {
                    $queryCollector->collectTransactionEvent('Commit Transaction', $transaction->connection);
                });

                $db->getEventDispatcher()->listen([
                                                      \Illuminate\Database\Events\TransactionRolledBack::class,
                                                      'connection.*.rollingBack',
                                                  ], function ($transaction) use ($queryCollector) {
                    $queryCollector->collectTransactionEvent('Rollback Transaction', $transaction->connection);
                });
            } catch (\Exception $e) {
                $this->addThrowable(
                    new Exception(
                        'Cannot add listen transactions to Queries for Songshenzong: ' . $e->getMessage(),
                        $e->getCode(),
                        $e
                    )
                );
            }
        }


        /**---------------------------------------------------------
         *   Catch mail messages
         *---------------------------------------------------------*/
        if ($this->shouldCollect('mail', true) && class_exists('Illuminate\Mail\MailServiceProvider')) {
            try {
                $mailer = $this->app['mailer']->getSwiftMailer();
                $this->addCollector(new SwiftMailCollector($mailer));
                if ($this->app['config']->get('songshenzong-log.options.mail.full_log') && $this->hasCollector(
                        'messages'
                    )
                ) {
                    $this['messages']->aggregate(new SwiftLogCollector($mailer));
                }
            } catch (\Exception $e) {
                $this->addThrowable(
                    new Exception(
                        'Cannot add MailCollector to SongshenzongLog: ' . $e->getMessage(),
                        $e->getCode(),
                        $e
                    )
                );
            }
        }


        /**---------------------------------------------------------
         *   Add the latest log messages
         *---------------------------------------------------------*/
        if ($this->shouldCollect('logs', false)) {
            try {
                $file = $this->app['config']->get('songshenzong-log.options.logs.file');
                $this->addCollector(new LogsCollector($file));
            } catch (\Exception $e) {
                $this->addThrowable(
                    new Exception(
                        'Cannot add LogsCollector to SongshenzongLog: ' . $e->getMessage(),
                        $e->getCode(),
                        $e
                    )
                );
            }
        }

        /**---------------------------------------------------------
         *   Show the included files
         *---------------------------------------------------------*/
        if ($this->shouldCollect('files', false)) {
            $this->addCollector(new FilesCollector($app));
        }


        /**---------------------------------------------------------
         *   Display Laravel authentication status
         *---------------------------------------------------------*/
        if ($this->shouldCollect('auth', false)) {
            try {
                if ($this->checkVersion('5.2')) {
                    // fix for compatibility with Laravel 5.2.*
                    $guards        = array_keys($this->app['config']->get('auth.guards'));
                    $authCollector = new MultiAuthCollector($app['auth'], $guards);
                } else {
                    $authCollector = new AuthCollector($app['auth']);
                }

                $authCollector->setShowName(
                    $this->app['config']->get('songshenzong-log.options.auth.show_name')
                );
                $this->addCollector($authCollector);
            } catch (\Exception $e) {
                $this->addThrowable(
                    new Exception(
                        'Cannot add AuthCollector to SongshenzongLog: ' . $e->getMessage(),
                        $e->getCode(),
                        $e
                    )
                );
            }
        }

        /**---------------------------------------------------------
         *   Display Laravel Gate checks
         *---------------------------------------------------------*/
        if ($this->shouldCollect('gate', false)) {
            try {
                $gateCollector = $this->app->make('Songshenzong\Log\DataCollector\GateCollector');
                $this->addCollector($gateCollector);
            } catch (\Exception $e) {
                // No Gate collector
            }
        }


        $this->booted = true;
    }