Hi there. I'm a newbies in Laravel framework. I have a problem with namespaces (as I see) . I use a subdirectory for controllers (controllers/admin) which are for using in the admin panel,I use namespaces also. I've made the first controller in that dir. and called it " HomeController".
<?php
namespace admin;
use Illuminate\Support\Facades\View;
use \AdminController;
use Illuminate\Support\Facades\Input as Input;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\Redirect;
use Cartalyst\Sentry\Facades\Laravel\Sentry;
class HomeController extends \AdminController
{
It works pretty well. Then I installed the Sentry auth library.... And then I got the first problem: The library works well, but I can't catch Exceptions which throws the library.
This is a code from my controller:
try {
// Login credentials
$credentials =...;
// Authenticate the user
$user = Sentry::authenticate($credentials, TRUE);
return Redirect::route($this->default_route);
}
catch (Cartalyst\Sentry\Users\LoginRequiredException $e) {
........
}
And catch (Cartalyst\Sentry\Users\LoginRequiredException $e) doesn't works. I get the error page "Whoops! There was an error."
"Cartalyst \ Sentry \ Users \ UserNotFoundException
A user could not be found with a login value of [asdf@asd.et]. "
If I use the controller in the root directory (controllers) it works nice and I can catch that error and show it in the view.
What do I do wrong?
P.S: Sorry for my mistakes. I don't know English )
try this
\Cartalyst\Sentry\Users\LoginRequiredException
Thanks a lot!! it works!!
catch (\Cartalyst\Sentry\Throttling\UserBannedException $e) {
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community