podcastartgenerator/site/app/Policies/ArtworkPolicy.php

35 lines
572 B
PHP
Raw Normal View History

<?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;
}
}