feat: adds ability for approved users to approve artwork

This commit is contained in:
2024-01-13 10:45:40 -06:00
parent bc66edb3ce
commit eb931bbb6a
9 changed files with 198 additions and 87 deletions

View File

@@ -0,0 +1,34 @@
<?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;
}
}