added support for adding/removing movies from a movie list
This commit is contained in:
parent
8970e82780
commit
95712abdb6
12 changed files with 138 additions and 262 deletions
49
app/Policies/MovieListPolicy.php
Normal file
49
app/Policies/MovieListPolicy.php
Normal 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;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue