Laravel snippets

routes/web.php

Add extra routes (e.g. dev.php) if the route file exists.

if (file_exists($rpath = base_path('routes').'/dev.php')) {
    Route::group(['prefix' => 'dev'],function() use ($rpath) {
        include_once($rpath);
    });
}