ldc-flucollector/app/Http/Requests/Api/XmlInco/SearchRequest.php
Jérémy Munsch c0c1608ad5
Api calls ok
2023-10-02 12:26:41 +02:00

42 lines
893 B
PHP

<?php
namespace App\Http\Requests\Api\XmlInco;
use Illuminate\Foundation\Http\FormRequest;
class SearchRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize(): bool
{
return auth('api')->check();
}
/**
* Prepare the data for validation.
*
* @return void
*/
protected function prepareForValidation()
{
$this->merge([
'search' => is_string($this->search) ? strip_tags($this->search) : null
]);
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string,\Illuminate\Contracts\Validation\ValidationRule|array|string>
*/
public function rules(): array
{
return [
'search' => 'required|string|min:1'
];
}
}