users
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user