0

Its about 13 hours I am trying to solve this issue, but no luck. I have setup Laravel 5.3 with Entrust. It was working fine. I have set a condition in the Controller to check whether the user has permission to the page s/he is trying to access. If not then just redirect to Home page. It was also working fine, but after some refreshing and browsing its doing a strange malfunctioning- everything is going to home page (e.g. http://mysite.dev/). Only Auth pages are okay (login/register etc).

So to be confirm, I have removed authorization check from that controller, but no luck. Then removed middleware "auth", but still the same redirection. So strange :( Some codes are given below-

routes/web.php

Auth::routes();            
Route::group(['middleware' => ['auth']], function() {
    Route::get('/user/view-profile', 'HomeController@profile')->name('profile');
    Route::get('/logout', 'HomeController@logout');
    Route::get('/accounts-groups/list-accounts-groups', 'HomeController@listAccountsGroups');
    Route::get('/', 'HomeController@index')->name('landing');
});

app/Http/Controllers/Controller.php

use AuthorizesRequests,
    DispatchesJobs,
    ValidatesRequests;

app/Http/Controllers/HomeController.php

    /**
     * Show the application dashboard.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        return view('home');
    }
    public function profile()
    {
        return "Profile Page";
    }
    public function listAccountsGroups()
    {
        return "Group Listing";
    }
    public function logout()
    {
        Auth::logout();
        return redirect()->route('landing');
    }

I am very new to Laravel, this is my first project, so learning and doing, but here I have just stucked...

Sadat
  • 3,493
  • 2
  • 30
  • 45

1 Answers1

0

Yes @Can Celik, Cookie was the problem. Actually I had done some permanent redirect and then remove those code, but it still performing permanent redirection based on cookie. THanks a lot @Can Celik.

Sadat
  • 3,493
  • 2
  • 30
  • 45