I don't know If this is possible with laravel or what is the best way to achieve it, i wan't if user click to like post or add to favorites and he is not authenticated to showing login form,
I want every visitor to have access to all posts, i have used before if(auth::check())
in my view to hide or display the buttons (like & favorite) if user authenticated, but i don't like this way. i want to display the buttons to all visitors but when a Unauthenticated user click on like button redirecting to login page.
I tried to add this method to my routes but seems not working
if (Auth:check()){
Route::post('/favorite/{post}', 'SiteController@favorite');
Route::post('/unfavorite/{post}', 'SiteController@unFavorite');
Route::post('/like/{post}', 'SiteController@like');
Route::post('/update/{post}', 'SiteController@update');
Route::post('/unlike/{post}', 'SiteController@unLike');
} else {
Route::get('/login', ['as' => 'login', 'uses' => 'Auth\LoginController@showLoginForm']);