Complete TP7 TP8 authentication authorization and classic CSS

This commit is contained in:
2026-10-21 00:48:38 +02:00
parent 4a84a17cbf
commit ffe85d5f0d
101 changed files with 7643 additions and 110 deletions
+65
View File
@@ -0,0 +1,65 @@
<?php
namespace App\Policies;
use App\Models\Product;
use App\Models\User;
class ProductPolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
return true;
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, Product $product): bool
{
return true;
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
return true;
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, Product $product): bool
{
return true;
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, Product $product): bool
{
return $user->is_admin;
}
/**
* Determine whether the user can restore the model.
*/
public function restore(User $user, Product $product): bool
{
return false;
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(User $user, Product $product): bool
{
return false;
}
}