Created
October 5, 2016 18:52
-
-
Save scottzirkel/a35e338253ccfe31036036d83a1d5a0b to your computer and use it in GitHub Desktop.
Lumen/Laravel Pages Controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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'; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$app->get('{page}', 'PagesController@page'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Simple page catch-all super controller.