public static function getPage($key) { $key = trim($key); $key = preg_replace('/\\s+/', ' ', $key); $page = Page::where('slug', self::slug($key))->first(); if (!$page) { $page = Page::where('title', $key)->first(); if (!$page) { $page = new Page(); $page->rev = 0; $page->title = $key; $page->slug = null; // view 에서 slug가 없으면 title을 사용하므로 null 처리 $page->content = ''; } } return $page; }