added support for adding/removing movies from a movie list

This commit is contained in:
Edward Tirado Jr 2026-03-02 17:33:41 -06:00
parent 8970e82780
commit 95712abdb6
12 changed files with 138 additions and 262 deletions

View file

@ -0,0 +1,49 @@
<?php
namespace App\Policies;
use App\Models\MovieList;
use App\Models\User;
class MovieListPolicy
{
/**
* Create a new policy instance.
*/
public function __construct()
{
//
}
public function create(User $user): bool
{
return true;
}
public function view(User $user, MovieList $movieList): bool
{
if ($movieList->owner === $user->getKey() || $movieList->isPublic) {
return true;
}
return false;
}
public function update(User $user, MovieList $movieList): bool
{
if ($movieList->owner === $user->getKey()) {
return true;
}
return false;
}
public function delete(User $user, MovieList $movieList): bool
{
if ($movieList->owner === $user->getKey()) {
return true;
}
return false;
}
}