mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-25 09:00:27 +00:00
Update Database.php
This commit is contained in:
parent
30e0009b94
commit
29b1ba8407
1 changed files with 12 additions and 0 deletions
|
@ -7,6 +7,7 @@ use App\UniversalDatabaseExecutor;
|
|||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class Database extends Model
|
||||
{
|
||||
|
@ -21,6 +22,17 @@ class Database extends Model
|
|||
'description',
|
||||
];
|
||||
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::addGlobalScope('customer', function (Builder $query) {
|
||||
if (auth()->check()) {
|
||||
$query->whereHas('hostingSubscription', function ($query) {
|
||||
$query->where('customer_id', auth()->user()->id);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
|
Loading…
Reference in a new issue