コード例 #1
0
ファイル: UserTest.php プロジェクト: tvpsoft/laravel-kinvey
 /**
  * Create a test user.
  *
  * @return GovTribe\LaravelKinvey\Database\Eloquent\User
  */
 public static function createTestUser()
 {
     Kinvey::setAuthMode('app');
     $user = new User();
     $user->setRawAttributes(array('email' => '*****@*****.**', 'first_name' => 'Test', 'last_name' => 'Guy', 'password' => str_random(8), 'original' => 'baz'));
     $user->save();
     Kinvey::setAuthMode('admin');
     return $user;
 }
コード例 #2
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;
         }
     });
 }
コード例 #3
0
ファイル: AuthTest.php プロジェクト: tvpsoft/laravel-kinvey
 /**
  * Tear down the test environment.
  *
  * @return array
  */
 public function tearDown()
 {
     Kinvey::setAuthMode('admin');
     $user = User::withTrashed()->where('_id', $this->testUser->_id)->first()->forceDelete();
     Kinvey::setAuthMode('app');
 }