0

Verify在 Laravel-4 中用作我的 Auth 服务。我设法成功安装和使用它。但是我想使用它的扩展异常来最大化它的使用。

class UserNotFoundException {} // User can't be found
class UserUnverifiedException {} // User isn't verified
class UserDisabledException {} // User has been disabled
class UserDeletedException {} // User has been deleted
class UserPasswordIncorrectException {} // User has entered the wrong password

我尝试使用此设置:

try {
    Auth::attempt($credentials);
} catch (UserNotFoundException $e) {
    echo "Not Found";
}

但没有用。但是当我使用 general 时Exception,它可以工作,但我收到一条一般消息。我该如何使用它?提前致谢。

4

0 回答 0