PArticipationPolicy fix viewWonList pour recettage
This commit is contained in:
parent
2ef26bc270
commit
d8ab0146e0
1 changed files with 6 additions and 2 deletions
|
|
@ -64,11 +64,15 @@ class ParticipationPolicy
|
|||
/**
|
||||
* Wether a customer can access to won list page
|
||||
*
|
||||
* @param \App\Models\Customer $authUser
|
||||
* @param \App\Models\Customer|\App\Models\User $authUser
|
||||
* @return boolean
|
||||
*/
|
||||
public function viewWonList(Customer $authUser): bool
|
||||
public function viewWonList(Customer|User $authUser): bool
|
||||
{
|
||||
if ($authUser instanceof User) {
|
||||
// * Recettage
|
||||
return true;
|
||||
}
|
||||
return (bool)$authUser->participations()->where(fn (Builder $q) =>
|
||||
$q->whereHas('instantWin')->orWhereHas('discount'))->count();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue