Esempio n. 1
0
    {
        return $this->getKey();
    }
    public function getAuthPassword()
    {
        return $this->password;
    }
    public function getReminderEmail()
    {
        return $this->email;
    }
}
TestUser::saving(function ($model) {
    if ($model->password && $model->isDirty('password')) {
        $model->password = \Hash::make($model->password);
    }
    return true;
});
TestUser::validating(function ($model) {
    $model->getValidator()->sometimes('password', 'min:4', function ($model) {
        return $model->password && $model->isDirty('password') ? TRUE : FALSE;
    });
    if ($model->name == 'discard') {
        return FALSE;
    }
});
TestUser::validated(function ($model) {
    if ($model->name == 'discard2') {
        return FALSE;
    }
});
Esempio n. 2
0
 /**
  * @expectedException Exception
  */
 function testBuilderException()
 {
     TestUser::buildingQuery(function ($query) {
         return 'this is bad';
     });
     TestUser::validating(function ($model) {
         return true;
     });
     TestUser::validated(function ($model) {
         return true;
     });
     TestUser::get();
 }