コード例 #1
0
ファイル: User.php プロジェクト: tvpsoft/laravel-kinvey
 /**
  * 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;
         }
     });
 }