This commit is contained in:
2017-12-22 09:08:16 +01:00
parent 109f329e93
commit c8259b0dcf
10 changed files with 135 additions and 6 deletions
+31
View File
@@ -0,0 +1,31 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 21/12/2017
* Time: 18:05
*/
use \Illuminate\Database\Eloquent\Model as Eloquent;
class Page extends Eloquent {
protected $table = "pages";
public function subpages()
{
return $this->hasMany( 'Page' );
}
public static function getPages()
{
$pages = Page::whereRaw( 'id = page_id' )
->with( 'subpages' )
->get();
return $pages;
}
}