$except= ['BaseController.php','Controller.php'];
$dir=app_path('Http/Controllers');
if($handle=opendir($dir)){
while($file=readdir($handle)) {
if(!is_dir($dir.'/'.$file) && !in_array($file,$except)) {
$route=strtolower(substr($file,0,-14));
$controller=substr($file,0,-4);
Route::resource($route,$controller);
}
}
closedir($handle);
}
网友评论