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

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -