php - laravel route any page in a folder -


i trying route blade file inside folder called "pages" (application/views/pages/page.blade.php)

$path = '/pages/'.$anyname.'.blade.php'; route::get('file/(:all)', function($path){}); 

how should change $anyname enable retrieve blade file?

i got working using scandir method.

$dir = path('app').'/views/pages/'; $pages = scandir($dir); unset($pages[array_search('.', $pages)]); unset($pages[array_search('..', $pages)]);  for($i = 2; $i <count($pages)+2; $i++){     //print_r($pages[$i]);     $temp = str_replace('.blade.php', '', $pages[$i]);      route::get($temp, function(){         //return view::('index');         return 'asd';     }); } 

Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -