35 lines
572 B
PHP
35 lines
572 B
PHP
<?php
|
|
|
|
namespace App\Policies;
|
|
|
|
use App\Models\User;
|
|
use App\Models\Artwork;
|
|
|
|
class ArtworkPolicy
|
|
{
|
|
/**
|
|
* Create a new policy instance.
|
|
*/
|
|
public function __construct()
|
|
{
|
|
//
|
|
}
|
|
|
|
public function viewAny(?User $user): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function approve(User $user): bool
|
|
{
|
|
if ($user->id == 4) {
|
|
return true;
|
|
}
|
|
$selectedCount = $user->selectedForEpisodes()->count();
|
|
if ($selectedCount > 5) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
}
|