/** * @return User * @throws ReflinkException */ public function getUser() { if (is_null($user = User::where('email', $this->email)->first())) { throw new ReflinkException(trans(Password::INVALID_USER)); } return $user; }
/** * Создание администратора. */ public function createAdmin(array $config) { // Delete seeder admin users User::where('email', 'like', '*****@*****.**')->delete(); $user = User::create(['email' => array_get($config, 'email'), 'password' => array_get($config, 'password'), 'username' => array_get($config, 'username'), 'locale' => array_get($config, 'locale', 'en')]); $user->roles()->sync([1, 2, 3]); }