Пример #1
0
 /**
  * The "booting" method of the model.
  *
  * @return void
  */
 public static function boot()
 {
     parent::boot();
     File::creating(function ($file) {
         if (!$file->path) {
             throw new \Exception('File model must contain a not-null path attribute');
         }
     });
 }
Пример #2
0
 /**
  * The "booting" method of the model.
  *
  * @return void
  */
 public static function boot()
 {
     parent::boot();
     User::creating(function ($user) {
         if (!$user->email) {
             throw new \Exception('User model must contain a not-null email attribute');
         }
         if (!$user->username) {
             $user->username = $user->email;
         }
     });
 }
 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->package('govtribe/laravel-kinvey', 'kinvey');
     Model::setConnectionResolver($this->app['db']);
     Model::setEventDispatcher($this->app['events']);
 }