vendredi 23 septembre 2016

Conditions In Routes.php Laravel

Sorry guys i am new in Laravel. I want to use conditions in Routes.php using laravel 5.2 When the User is logged i want to call the showExperience function else redirect to login My routes.php code

Route::get('/profile', function () { if (Auth::check()) {

    $url = action('ProfilesController@showExperience');
    return redirect($url);
} else {
    return Redirect::to('login');
}

});

here is My ProfilesController.php

public function showExperience(){ $data = Experience::all();

    return view('profile')->with('experienceData',$data);
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire