Support the ongoing development of Laravel.io →
Installation Authentication Packages

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]. "

  • the page says to me.

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 )

package's docs

Last updated 3 years ago.
0

try this

\Cartalyst\Sentry\Users\LoginRequiredException
Last updated 3 years ago.
0

Thanks a lot!! it works!!

catch (\Cartalyst\Sentry\Throttling\UserBannedException $e) {
Last updated 3 years ago.
0

Sign in to participate in this thread!

PHPverse

Your banner here too?

siptik siptik Joined 12 Jun 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.