50 lines
1 KiB
PHP
50 lines
1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Bo;
|
|
|
|
use ArondeParon\RequestSanitizer\Sanitizers\FilterVars;
|
|
use ArondeParon\RequestSanitizer\Traits\SanitizesInputs;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class ManageBrandRequest extends FormRequest
|
|
{
|
|
use SanitizesInputs;
|
|
|
|
/**
|
|
* Using these sanitizers before proceeding the request
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $sanitizers = [
|
|
'name' => [
|
|
FilterVars::class => [
|
|
'filter' => FILTER_SANITIZE_STRING
|
|
]
|
|
],
|
|
];
|
|
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*
|
|
* @return boolean
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return auth('backend')->check();
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
if ($this->isMethod('post')) {
|
|
return [
|
|
'name' => 'required|string|min:5|max:255'
|
|
];
|
|
}
|
|
return [];
|
|
}
|
|
}
|