user or customer (various gates) for product policy

This commit is contained in:
Olivier Legat 2022-03-20 11:58:05 +01:00
parent 6c32f37e40
commit bac1ea1386

View file

@ -23,7 +23,10 @@ class ProductPolicy
//
}
public function addToCart(Customers $user = null, Product $product) {
/**
* $user is a App\Models\User or a App\Models\Customers
*/
public function addToCart($user = null, Product $product) {
$now = Carbon::now();
if($product->orderable_start === null or $product->orderable_start <= $now) {
//on est entré dans la période commandable ou c'est commandable depuis toujours