This commit is contained in:
2017-12-25 20:23:32 +01:00
parent 1175a4f8ff
commit 0cc882060c
36 changed files with 781 additions and 86 deletions
+15 -7
View File
@@ -18,20 +18,28 @@ class Page extends Eloquent {
}
public static function getPages($user)
public static function getPages( $user )
{
$pages = Page::whereRaw( 'id = page_id AND ' )
->with( ['subpages' => function($q){
$q->whereRaw('id != page_id');
}] )
$pages = Page::whereRaw( 'id = page_id' )
->with( [
'subpages' => function ( $q ) use ( $user ) {
$q->whereRaw(
"id != page_id AND ((SELECT {$user->role} & pagelevel) != 0 OR pagelevel = 0)" );
}] )
->get();
return $pages;
}
public static function getAppPages()
public static function getAppPages( $user )
{
$appPages = Page::whereRaw
$appPages = Page::select( 'id', 'pageurl' )
->whereAppPage( 'T' )
->whereRaw(
"((SELECT {$user->role} & pagelevel) != 0 OR pagelevel = 0)" )
->get();
return $appPages;
}