fix small issue
This commit is contained in:
parent
8e1615ac5f
commit
3d181623c3
1 changed files with 5 additions and 1 deletions
|
@ -20,7 +20,11 @@ class Item extends Model
|
|||
|
||||
static::addGlobalScope('user_id', function (Builder $builder) {
|
||||
$current_user = User::currentUser();
|
||||
$builder->where('user_id', $current_user->id)->orWhere('user_id', 0);
|
||||
if($current_user) {
|
||||
$builder->where('user_id', $current_user->id)->orWhere('user_id', 0);
|
||||
} else {
|
||||
$builder->where('user_id', 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue