Fix for BBS List
This commit is contained in:
parent
b1d522d8cc
commit
073be20ceb
@ -17,16 +17,17 @@ class System extends Model
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Only query active records
|
* Only query active records
|
||||||
|
* @todo test false action
|
||||||
*/
|
*/
|
||||||
public function scopeActive($query)
|
public function scopeActive($query)
|
||||||
{
|
{
|
||||||
$uo = Auth::user();
|
$uo = Auth::user();
|
||||||
|
|
||||||
return $query
|
return $query
|
||||||
->when(! $uo->isAdmin(),function($query) use ($uo) {
|
->when($uo && ! $uo->isAdmin(),function($query) use ($uo) {
|
||||||
return $query->whereIn('id',$uo->systems->pluck('id'))
|
return $query->whereIn('id',$uo->systems->pluck('id'))
|
||||||
->orWhere($this->getTable().'.active',TRUE);
|
->orWhere($this->getTable().'.active',TRUE);
|
||||||
})
|
},function($query) { $query->where($this->getTable().'.active',TRUE); })
|
||||||
->orderBy('name');
|
->orderBy('name');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user