Boot uuid trait.

@return void
778824
protected static function bootUuid()
    {
        static::creating(function ($model) {
            if (! Generator::isValid($model->{$model->getKeyName()})) {
                $model->{$model->getKeyName()} = Generator::uuid4()->toString();
            }
        });
    }
99885
public function boot()
    {
        $path = \realpath(__DIR__.'/../');

        $this->addConfigComponent('orchestra/memory', 'orchestra/memory', "{$path}/config");

        if (! $this->hasPackageRepository()) {
            $this->bootUnderLaravel($path);
        }

        $this->loadMigrationsFrom([
            "{$path}/database/migrations",
        ]);

        $this->bootMemoryEvent();
    }
542435
protected static function boot()
    {
        parent::boot();

        self::creating(function ($model) {
            do {
                $id = mt_rand(pow(10, 9), pow(2, 32) - 1);
            } while (self::find($id));

            $model->{$model->getKeyName()} = $id;
        });
    }
37386
protected static function bootTraits()
    {
        $class = static::class;

        $booted = [];

        static::$traitInitializers[$class] = [];

        foreach (class_uses_recursive($class) as $trait) {
            $method = 'boot'.class_basename($trait);

            if (method_exists($class, $method) && ! in_array($method, $booted)) {
                forward_static_call([$class, $method]);

                $booted[] = $method;
            }

            if (method_exists($class, $method = 'initialize'.class_basename($trait))) {
                static::$traitInitializers[$class][] = $method;

                static::$traitInitializers[$class] = array_unique(
                    static::$traitInitializers[$class]
                );
            }
        }
    }
287130
public function boot() : void
    {
        $kernel = app(Kernel::class);

        if (class_uses_trait($kernel, RegistersRouters::class)) {
            $kernel->bootRouters();
        }
    }
223826
public function boot()
    {
        if ($this->app->runningInConsole()) {
            $this->publishes([
                __DIR__ . '/../config/config.php' => config_path('wallet.php'),
            ], 'config');

            $this->publishes([
                __DIR__ . '/../resources/migrations/' => database_path('migrations'),
            ], 'migrations');
        }
    }
17868
public function boot()
    {
        $this->loadMigrationsFrom(__DIR__.'/../../migrations');
        $this->publishes(
            [
                __DIR__.'/../../config/passwordless.php' => config_path('passwordless.php'),
                __DIR__.'/../../lang'                    => resource_path('lang/vendor/passwordless'),
            ]
        );
    }
1098785
public function boot()
    {
        $this->publishes(
            [
                $this->getConfigPath() => config_path('vanilla-integration.php'),
            ],
            'config'
        );
        $this->loadRoutesFrom(__DIR__ . '/../../../routes/routes.php');
        $this->registerHelpers();
    }
1246432
public function boot()
    {
        /*
         * Migrations
         */
        $this->publishes([
            __DIR__ . '/../database/factories' => database_path('factories/'),
        ], $this->package_tag . '-factories');
        $this->publishes([
            __DIR__ . '/../database/migrations' => database_path('migrations/'),
        ], $this->package_tag . '-migrations');
        $this->publishes([
            __DIR__ . '/../database/seeds' => database_path('seeds/'),
        ], $this->package_tag . '-seeds');

        /*
         * Commands
         */
        if ($this->app->runningInConsole()) {
            $this->commands([
                \CleaniqueCoders\Profile\Console\Commands\SeedProfileCommand::class,
            ]);
        }
    }
971788
public function boot()
    {
        DynamoDbModel::setDynamoDbClientService($this->app->make(DynamoDbClientInterface::class));

        $this->publishes([
            __DIR__.'/../config/dynamodb.php' => app()->basePath('config/dynamodb.php'),
        ]);
    }
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'];
        });
    }
982770
protected function kickUid($uid)
    {
        if (Start::$testUnity) {
            $this->testUnitSendStack[] = ['action' => 'kickUid', 'uid' => $uid];
        } else {
            get_instance()->kickUid($uid);
        }
    }
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);
    }
401746
public static function boot()
    {
        parent::boot();

        static::deleted(function (Group $group) {
            $group->raise(new Deleted($group));
        });
    }
1209686
public function boot()
    {
        if (!class_exists('CreateTokensTable')) {
            // Publish the migration
            $timestamp = date('Y_m_d_His', time());
            $this->publishes([
                __DIR__ . '/../../database/migrations/create_tokens_table.php.stub' => database_path('migrations/' . $timestamp . '_create_tokens_table.php'),
            ], 'migrations');
        }
    }
774874
public function boot()
	{
		$this->package('flatline/mongol');

		// Register the mongol Auth driver
		Auth::extend('mongol', function() {
			$table = $this->app['config']['auth.table'];
		    $provider = new MongolUserProvider(Mongol::connection(), $this->app['hash'], $table);
		    return new Guard($provider, $this->app['session']);
		});
	}
429676
public function boot()
    {
        // Lumen is limited, so always add the preflight.
        if ($this->isLumen()) {
            $this->app->middleware([HandlePreflight::class]);
        } else {
            $this->publishes([$this->configPath() => config_path('cors.php')]);

            /** @var \Illuminate\Foundation\Http\Kernel $kernel */
            $kernel = $this->app->make(Kernel::class);

            // When the HandleCors middleware is not attached globally, add the PreflightCheck
            if (! $kernel->hasMiddleware(HandleCors::class)) {
                $kernel->prependMiddleware(HandlePreflight::class);
            }
        }
    }