samedi 30 janvier 2016

Laravel- Redirect user to profile page

I am trying to redirect the user if he logs in for the first time to step2 page, I have tried the following

    public function postLogin(Request $request){

    $credentials = $request->only('login_email', 'login_password');
    $credential = ['email'=> $credentials['login_email'], 'password' => $credentials['login_password']];
    if (Auth::attempt($credential)) {
        // if profile not set, redirect to step 2 page
        if(Auth::user()->first_login) {

          return  $this->getStep2(Auth::user()->id);


        }
}

but it shows me

{"login":true}

My getStep2() is like

    public function getStep2($id){
    $genres = Track::orderBy('genre', 'asc')->groupBy('genre')->get();
    $countries = Country::all();
    $categories = Category::where('parent_id',  '')->get();
    $user_id = $id;
    return view('users.step2', compact('genres', 'countries', 'categories', 'user_id'));
}



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

Aucun commentaire:

Enregistrer un commentaire