ldc-dam/app/Http/Requests/Bo/UpdateBrandUserRequest.php

43 lines
872 B
PHP

<?php
namespace App\Http\Requests\Bo;
use Illuminate\Foundation\Http\FormRequest;
class UpdateBrandUserRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize(): bool
{
return auth()->check();
}
/**
* Prepare the data for validation.
*
* @return void
*/
protected function prepareForValidation()
{
$this->merge([
'users' => !$this->users ? null : \explode(',', \strval($this->users))
]);
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, mixed>
*/
public function rules()
{
return [
'users' => 'nullable|array',
'users.*' => 'required|exists:users,id',
];
}
}