refactor: update payroll generation to exclude Developer and Owner roles using the new withoutSuperAdmin scope.
This commit is contained in:
parent
c2bcb3d47b
commit
e89cfd337a
@ -24,7 +24,7 @@ public function handle(): void
|
|||||||
|
|
||||||
$users = User::whereHas('employee')
|
$users = User::whereHas('employee')
|
||||||
->active()
|
->active()
|
||||||
->withoutDeveloper()
|
->withoutSuperAdmin()
|
||||||
->with('employee')
|
->with('employee')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
|||||||
@ -60,6 +60,14 @@ protected function withoutDeveloper(Builder $query): void
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Scope]
|
||||||
|
protected function withoutSuperAdmin(Builder $query): void
|
||||||
|
{
|
||||||
|
$query->whereDoesntHave('roles', function ($q) {
|
||||||
|
$q->whereIn('name', ['Developer', 'Owner']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public function articles(): HasMany
|
public function articles(): HasMany
|
||||||
{
|
{
|
||||||
return $this->hasMany(Article::class, 'author_id');
|
return $this->hasMany(Article::class, 'author_id');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user