php - Laravel custom Admin-Filter with redirect-loop -
php - Laravel custom Admin-Filter with redirect-loop -
i got dumb question here. i've endless redirect in app. understand why, don't know solve issue.
in routes.php i've next code:
route::filter('admin', function(){ if(auth::user()->admin){ homecoming redirect::to(route::current()->getpath()); }else{ homecoming redirect::to('/'); } }); route::when('admin/*', 'admin');
when phone call url /admin/createnews
browser loading while , tell me there redirect. me logical don't know here.
if filter passes, execution flow go on requested route, without need return redirect
. solution reverse logic:
route::filter('admin', function() { if( !(auth::user()->admin) ) { homecoming redirect::to('/'); } });
php laravel admin
Comments
Post a Comment