amber-laravel/app/Http/Requests/ToolRequest.php

34 lines
675 B
PHP
Raw Normal View History

2024-07-24 08:13:16 +00:00
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class ToolRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
$tool = $this->route('tool');
if ($tool) {
return $tool->user_id === $this->user()->id;
}
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
//
];
}
}