php - laravel 5.4 route group redirect -


i have created route group this:

route::group( [ 'middleware' => [ 'auth' ] ], function () {     // instagram     route::get( '/hashtags', 'mycontroller@index' )->name( 'my.index' ); } ); 

when try access /hashtag url when not logged in redirected /login url. how can change / url don't see login page?

change unauthenticated function in app/exceptions/handler.php

protected function unauthenticated($request, authenticationexception $exception) {     if ($request->expectsjson()) {         return response()->json(['error' => 'unauthenticated.'], 401);     }      return redirect()->guest(route('yourdesiredroute')); } 

https://laracasts.com/discuss/channels/laravel/default-redirect-login-page-if-not-authenticate-in-54


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -