示例#1
0
 /**
  * @return bool
  */
 protected function validateAccountAnonymously()
 {
     if (!isset($this->data['user_id'])) {
         return false;
     }
     $user = User::find($this->data['user_id']);
     $type = AccountType::find($this->data['account_type_id'])->first();
     $value = $this->tryDecrypt($this->data['name']);
     $set = $user->accounts()->where('account_type_id', $type->id)->get();
     /** @var Account $entry */
     foreach ($set as $entry) {
         if ($entry->name == $value) {
             return false;
         }
     }
     return true;
 }
示例#2
0
 /**
  * @return User
  */
 public function user()
 {
     return User::find(1);
 }