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

Popular posts from this blog

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -