mercredi 2 mars 2016

laravel 5.2 call route from controller

i am calling getting_started route after successfully login

 protected $redirectTo = '/getting_started';

here is my getting_started route code:

    Route::get('/getting_started','UserController@getting_started');

and controller code:

public function getting_started()
{
    $id= Auth::id();
    $user = DB::table('user_profiles')->where('user_id', '=', $id)->first();
    if($user->dashboard_access == 0)
    {
        DB::table('user_profiles')
            ->where('user_id', $id)
            ->update(['dashboard_access' => 1]);
        return view('user.getting_started');
    }
    return view('user.dashboard');
}

it work perfectly and show in url

http://localhost:8080/getting_started

now i actually want that if user.dashboard view is call it show in url like http://localhost:8080/dashboard

and on getting_started view show http://localhost:8080/getting_started

it is possible to call dashboard route instead of

  return view('user.dashboard');

my dashobard route is

    Route::get('/dashboard',['middleware' => 'auth', function () {
    return view('user.dashboard');
}]);



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

Aucun commentaire:

Enregistrer un commentaire