Skip to content

Instantly share code, notes, and snippets.

@scottzirkel
Created October 5, 2016 18:52
Show Gist options
  • Save scottzirkel/a35e338253ccfe31036036d83a1d5a0b to your computer and use it in GitHub Desktop.
Save scottzirkel/a35e338253ccfe31036036d83a1d5a0b to your computer and use it in GitHub Desktop.
Lumen/Laravel Pages Controller
<?php
namespace App\Http\Controllers;
class PagesController extends Controller
{
public function page($page)
{
if (file_exists('../resources/views/templates/' . $page . '.blade.php'))
{
return view('templates/' . $page);
} else {
return '404';
}
}
}
$app->get('{page}', 'PagesController@page');
@scottzirkel
Copy link
Author

Simple page catch-all super controller.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment