/** * Define the routes for the application. * * @param \Illuminate\Routing\Router $router * @return void */ public function map(Router $router) { $router->group(['namespace' => $this->namespace], function ($router) { require app_path('Http/routes.php'); }); foreach (Page::all() as $page) { $router->get($page->uri, ['as' => $page->name, function () use($page, $router) { return $this->app->call('blogCms\\Http\\Controllers\\PageController@show', ['page' => $page, 'parameters' => $router->current()->parameters()]); }]); } }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $pages = $this->page->all(); return view('backend.pages.index', compact('pages')); }