42 lines
893 B
PHP
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'
|
|
];
|
|
}
|
|
}
|