mardi 3 mai 2016

Laravel 5 Routing admin error

I have a problem.

I can't go to the admin part of my site. I'm landing always on the main site. This problem is only with admin, every another routes working perfectly.

Routes:

Route::group(['middleware' => ['web']], function () {

    // Login, logout
    Route::get('admin', array('as' => 'login', 'uses' => 'AuthController@index'));
    Route::post('admin/login', array('as' => 'cms_login', 'uses' => 'AuthController@login', 'before' => 'csrf'));
    Route::get('admin/logout', array('as' => 'logout', 'uses' => 'AuthController@logout'));

...
}

AuthController:

    public function index()
    {
        // Show login form
        return view('backend/pages/login');
    } // index()


    public function login(Request $request)
    {

        // Form validation
        //

        // Rules for the input fields:
        // - email: must be an valid email
        // - password: alpha nummeric with 6 characters minimum
        $validators = array(
            'email'    => 'required|email',
            'password' => 'required|alphaNum|min:6'
        );

        // Run the validators on the inputs fields
        $validator = Validator::make(Input::all(), $validators);

        //
        // User validation
        //

        // Get input fields values
        $email = Input::get('email');
        $password = Input::get('password');

        // Log in if user credentials are valid
        if(Auth::attempt(array('email' => $email, 'password' => $password)))  {
        return view('backend/pages/cms')
        }
       .....


Doesn't matter what I do, I landing always on the home screen www.example.com
if I try to call http://ift.tt/1dONj01.

If I using this kind of route, I'm landing on the login form site, but if I click on "login" I'm landing again on the first page.
   Route::get('admin', function() {
        return view('backend/pages/login');
    });

Do somebody any idea what is the problem?

Thank you



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1NRNTkC
via IFTTT

Aucun commentaire:

Enregistrer un commentaire