Illuminate\Database\Eloquent\Model::bootIfNotBooted PHP Method

bootIfNotBooted() protected method

Check if the model needs to be booted and if so, do it.
protected bootIfNotBooted ( ) : void
return void
    protected function bootIfNotBooted()
    {
        if (!isset(static::$booted[static::class])) {
            static::$booted[static::class] = true;
            $this->fireModelEvent('booting', false);
            static::boot();
            $this->fireModelEvent('booted', false);
        }
    }

Usage Example

Example #1
0
 protected function bootIfNotBooted()
 {
     $this->i18n_default_locale = Session::get("language", "en");
     parent::bootIfNotBooted();
 }
Model