hasMany( 'Page' ); } public static function getPages() { $pages = Page::whereRaw( 'id = page_id' ) ->with( 'subpages' ) ->get(); return $pages; } }