/** * 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('SundaySim\\Http\\Controllers\\PageController@show', ['page' => $page, 'parameters' => $router->current()->parameters()]); }]); } }
protected function updatePageOrder(Page $page, Request $request) { if ($request->has('order', 'orderPage')) { try { $page->updateOrder($request->input('order'), $request->input('orderPage')); } catch (MoveNotPossibleException $e) { return redirect(route('backend.pages.edit', $page->id))->withInput()->withErrors(['error' => 'Cannot make a page a child of itself.']); } } }