Files
snipe-it/app/Http/Requests/AuditRequest.php
snipe a3e35e0c99 Added form request
Signed-off-by: snipe <snipe@snipe.net>
2025-06-25 16:29:42 +01:00

31 lines
683 B
PHP

<?php
namespace App\Http\Requests;
use App\Models\Asset;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Gate;
class AuditRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return Gate::allows('audit', new Asset);
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'asset_tag' => 'required|exists:assets,asset_tag',
];
}
}