fix policies

This commit is contained in:
mahdi purHosseini
2024-01-03 14:24:19 +03:30
parent 7068eeb561
commit e345034978
5 changed files with 12 additions and 25 deletions
+1 -4
View File
@@ -2,16 +2,13 @@
namespace App\Http\Requests;
use App\Item;
use Illuminate\Foundation\Http\FormRequest;
class StoreItemRequest extends FormRequest
{
public function authorize()
{
if ($this->method() == 'POST') {
return auth('api')->check() && auth('api')->user()->can('store', Item::class);
} else {
if ($this->method() != 'POST') {
$Item = $this->route('Item');
return auth('api')->check() && $Item && auth('api')->user()->can('update', $Item);
}