URL Shortener 1.0
A Laravel-based URL shortener application
Chargement...
Recherche...
Aucune correspondance
ShortUrlPolicy.php
Aller à la documentation de ce fichier.
1<?php
2
3namespace App\Policies;
4
7use Illuminate\Auth\Access\Response;
8
10{
14 public function viewAny(User $user): bool
15 {
16 return true;
17 }
18
22 public function view(User $user, ShortUrl $shortUrl): bool
23 {
24 return $user->id === $shortUrl->user_id;
25 }
26
30 public function create(User $user): bool
31 {
32 return true;
33 }
34
38 public function update(User $user, ShortUrl $shortUrl): bool
39 {
40 return $user->id === $shortUrl->user_id;
41 }
42
46 public function delete(User $user, ShortUrl $shortUrl): bool
47 {
48 return $user->id === $shortUrl->user_id;
49 }
50
54 public function restore(User $user, ShortUrl $shortUrl): bool
55 {
56 return $user->id === $shortUrl->user_id;
57 }
58
62 public function forceDelete(User $user, ShortUrl $shortUrl): bool
63 {
64 return $user->id === $shortUrl->user_id;
65 }
66}
update(User $user, ShortUrl $shortUrl)
Determine whether the user can update the model.
restore(User $user, ShortUrl $shortUrl)
Determine whether the user can restore the model.
create(User $user)
Determine whether the user can create models.
viewAny(User $user)
Determine whether the user can view any models.
forceDelete(User $user, ShortUrl $shortUrl)
Determine whether the user can permanently delete the model.
view(User $user, ShortUrl $shortUrl)
Determine whether the user can view the model.