public function up()
 {
     /** @var Page $page */
     foreach (Page::all() as $page) {
         $page->view()->associate(View::create(['layout' => $page->layout]));
         $page->save();
     }
 }
 private function getView(Content $content, $layout)
 {
     if (!isset($content->value)) {
         $view = View::create(['layout' => $layout]);
         $content->value = $view->id;
         return $view;
     }
     return View::find($content->value);
 }
 public function store(Request $request, Redirector $redirect)
 {
     $view = View::make();
     $view->save();
     $page = Page::make($request->input('uri'));
     $page->view()->associate($view);
     $page->save();
     return $redirect->route('admin.pages.edit', $page);
 }