如何在Toddish \ Verify中使用例外?

时间:2013-07-05 02:25:45

标签: laravel laravel-4 verify

我在Laravel-4中使用Verify作为我的Auth服务。我设法成功安装并使用它。但是我希望使用扩展的Exceptions来最大化它的使用。

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";
}

但没有奏效。但是当我使用通用Exception时,它可以正常工作,但我得到了一般信息。我该如何使用它?提前谢谢。

0 个答案:

没有答案
相关问题