accounts->pluck('id')->search($ao->id) !== FALSE) // The user is the wholesaler OR $uo->isWholesaler() // The user has this as one of their accounts OR $uo->accounts->pluck('id')->contains($ao->id); } /** * Determine whether the user can create services. * * @param User $uo * @return bool */ public function create(User $uo): bool { return TRUE; } /** * Determine whether the user can update the service. * * @param User $uo * @param Account $ao * @return bool */ public function update(User $uo,Account $ao): bool { return $uo->isWholesaler(); } /** * Determine whether the user can delete the service. * * @param User $uo * @param Account $ao * @return bool */ public function delete(User $uo,Account $ao): bool { return $uo->isWholesaler(); } /** * Determine whether the user can restore the service. * * @param User $uo * @param Account $ao * @return bool */ public function restore(User $uo,Account $ao): bool { return $uo->isWholesaler(); } /** * Determine whether the user can permanently delete the service. * * @param User $uo * @param Account $ao * @return bool */ public function forceDelete(User $uo,Account $ao): bool { return $uo->isWholesaler(); } }