Middleware auth not working with web Laravel 5.2
<p>Hi I am having some problem with authentication in laravel. I have to use two middleware 1. is web and 2. auth . I am using web middleware so that I can use session to show flash messages. and want to use auth middleware to do authentication of users/admin. but I am facing some problems. </p>

<p>below is my function to check authorization and to redirect to their respective routes</p>

<pre><code>  public function postLoginForm(){

    $email=Input::get('email');
    $password=Input::get('password');

    $data=[
        'email'=&gt;$email,
        'password'=&gt;$password
    ];
    $rules=[

        'email'=&gt;'required',
        'password'=&gt;'required'

    ];

    $validator=Validator::make($data,$rules);

    if($validator-&gt;fails()){

        Session::flash('fail', 'Oops Something went wrong!!');
        return redirect()-&gt;back()-&gt;withErrors($validator);

    }
    else{



        if(Auth::attempt($data)){




            $checkStatus=User::select('*')-&gt;where('email',$email)-&gt;first();

            Session::put('email',$checkStatus-&gt;email);
            Session::put('user_type',$checkStatus-&gt;user_type);




            if($checkStatus['user_type']=='4'){
                if($checkStatus['status']=='0'){
                    Session::flash('wait', 'Registration is not approved!!');

                    return "student";
                    return redirect()-&gt;back();
                }
                else{

                    return "student else";

                    return Redirect::route('get.student.dashBoard');

                }
            }
            else if($checkStatus['user_type']=='1'){


                return Redirect::route('get.admin.dashBoard');

            }
            else if($checkStatus['user_type']=='2'){


                return 'admin sir view';

                return Redirect::route('get.admin.dashBoard');
            }
            else if($checkStatus['user_type']=='3'){



                return 'admin other view';


                return Redirect::route('get.admin.dashBoard');
            }
            else{
                Session::flash('fail', 'Oops Something went wrong!!');
                return redirect()-&gt;back();
            }

        }
        else{
            Session::flash('fail', 'Login details not matched!!');
            return redirect()-&gt;back();
        }

    }
    return 'nothing works';

}
</code></pre>

<p>below is my routes for admin </p>

<pre><code>    Route::group(['middleware' =&gt; ['web']], function () {

Route::get('/login',
    ['as' =&gt; 'get.login.page',
        'uses' =&gt; 'LoginController@getLoginPage']);

Route::post('/login-done',
    ['as' =&gt; 'post.login.page',
        'uses' =&gt; 'LoginController@postLoginForm']);


Route::get('/register',
    ['as' =&gt; 'get.register.page',
        'uses' =&gt; 'LoginController@getRegisterPage']);

Route::post('/register',
    ['as' =&gt; 'post.register.form',
        'uses' =&gt; 'LoginController@postRegisterForm']);

Route::get('/forgot-password',
    ['as' =&gt; 'get.forgotPassword.form',
        'uses' =&gt; 'LoginController@getForgotPasswordForm']);



      Route::group(['middleware' =&gt; ['auth']], function () {


    Route::get('/admin-dashboard',
        ['as' =&gt; 'get.admin.dashBoard',
            'uses' =&gt; 'admin\PageController@getAdminDashboard']);


    Route::get('/all-achievements',
        ['as' =&gt; 'get.achievements',
            'uses' =&gt; 'admin\AchievementsController@getAchievementsList']);

    Route::get('/new-achievement',
        ['as' =&gt; 'get.add.achievement',
            'uses' =&gt; 'admin\AchievementsController@getAddAchievement']);

    Route::post('/add-achievement',
        ['as' =&gt; 'post.achievementsForm',
            'uses' =&gt; 'admin\AchievementsController@postAchievements']);


    Route::get('remove-achievement/{achie_slug}',
        ['as' =&gt; 'post.delete.achievements',
            'uses' =&gt; 'admin\AchievementsController@postDeleteAchievement']);

    Route::get('edit-achievement/{achie_slug}',
        ['as' =&gt; 'get.edit.achievements',
            'uses' =&gt; 'admin\AchievementsController@getEditAchievement']);

    Route::post('update-achievement/{ach_id}',
        ['as' =&gt; 'post.edited.achievement',
            'uses' =&gt; 'admin\AchievementsController@postEditedAchievement']);


    Route::get('/all-news',
        ['as' =&gt; 'get.news.list',
            'uses' =&gt; 'admin\NewsController@getNewsList']);


    Route::get('/add-news',
        ['as' =&gt; 'get.add.news',
            'uses' =&gt; 'admin\NewsController@getAddNews']);


    Route::post('/add-news',
        ['as' =&gt; 'post.add.news',
            'uses' =&gt; 'admin\NewsController@postAddNews']);

    Route::get('/delete-news/{news_slug}',
        ['as' =&gt; 'get.delete.news',
            'uses' =&gt; 'admin\NewsController@postDeleteNews']);

    Route::get('/edit-news/{news_slug}',
        ['as' =&gt; 'get.edit.news',
            'uses' =&gt; 'admin\NewsController@getEditNews']);


    Route::post('/edit-news/{news_slug}',
        ['as' =&gt; 'post.edited.news',
            'uses' =&gt; 'admin\NewsController@postEditedNews']);




    Route::get('/all-admins',
        ['as' =&gt; 'get.admin.list',
            'uses' =&gt; 'admin\AdminController@getAllAdminList']);

    Route::get('/add-admin',
        ['as' =&gt; 'add.new.admin',
            'uses' =&gt; 'admin\AdminController@getAddNewAdmin']);

    Route::post('/add-new-admin',
        ['as' =&gt; 'post.add.new.admin',
            'uses' =&gt; 'admin\AdminController@postAddNewAdmin']);


    Route::get('/all-schedule',
        ['as' =&gt; 'get.timeTable.list',
            'uses' =&gt; 'admin\TimeTableController@getTimeTableList']);

    Route::get('/add-schedule/{id}',
        ['as' =&gt; 'add.timeTable',
            'uses' =&gt; 'admin\TimeTableController@getAddNewBatch']);

    Route::post('/add-new-batch',
        ['as' =&gt; 'add.newBatch',
            'uses' =&gt; 'admin\TimeTableController@postAddNewBatch']);

    Route::post('/save-year-batch',
        ['as' =&gt; 'save.year.batch',
            'uses' =&gt; 'admin\TimeTableController@postSaveYearBatch']);

    Route::get('/schedule-table/{year}',
        ['as' =&gt; 'view.schedule.table',
            'uses' =&gt; 'admin\TimeTableController@getScheduleTable']);

    Route::get('/delete-schedule/{slug}',
        ['as' =&gt; 'delete.schedule.one',
            'uses' =&gt; 'admin\TimeTableController@postDeleteOneSchedule']);

    Route::get('/edit-schedule/{slug}',
        ['as' =&gt; 'edit.schedule.one',
            'uses' =&gt; 'admin\TimeTableController@getEditScheduleForm']);

    Route::post('/save-edited-schedule/{id}',
        ['as' =&gt; 'save.edited.schedule',
            'uses' =&gt; 'admin\TimeTableController@postEditScheduleForm']);




    Route::get('/all-results',
        ['as' =&gt; 'get.all.results',
            'uses' =&gt; 'admin\ResultsController@getAllResults']);

    Route::get('/add-result',
        ['as' =&gt; 'get.add.results',
            'uses' =&gt; 'admin\ResultsController@getAddResult']);

    Route::post('/add-new-result',
        ['as' =&gt; 'post.add.result',
            'uses' =&gt; 'admin\ResultsController@postAddResult']);

    Route::get('/delete-result/{id}',
        ['as' =&gt; 'get.delete.student.result',
            'uses' =&gt; 'admin\ResultsController@getDeleteResult']);

    Route::get('/edit-result/{id}',
        ['as' =&gt; 'get.edit.student.result',
            'uses' =&gt; 'admin\ResultsController@getEditResult']);


    Route::post('/save-edited-result/{id}',
        ['as' =&gt; 'post.edited.result',
            'uses' =&gt; 'admin\ResultsController@postEditedResult']);


    Route::get('/contact-messages',
        ['as' =&gt; 'get.contact.message',
            'uses' =&gt; 'admin\ContactMessageController@getAllContactMessages']);


    Route::get('/contact-messages/{id}',
        ['as' =&gt; 'get.delete.contact.message',
            'uses' =&gt; 'admin\ContactMessageController@getDeleteContactMessages']);


});

  });
</code></pre>

<p>every time i try to login it redirects me to the same login page. please guide me whats wrong with this.</p>