In Laravel 5.5 is it possible to prevent already signed-in user from accessing any page other than one I specify?
Example: I would like to force user to select his/her Time zone under their profile before letting them access any other menu item. Hiding menu items until Time zone is selected is not an option. I've read about guards, middleware but cannot understand much of it.
Thank you.
Use a middleware here middleware are the best choice to do task like this you can refer the doc for getting more about middleware
<?php
namespace App\Http\Middleware;
use Closure;
class AfterMiddleware
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
// your whatever logic
return $next($request);
}
}