36 lines
927 B
PHP
36 lines
927 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Bo\Urls;
|
|
|
|
use App\Enums\Users\RoleEnum;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class UpdateUrlRequest extends StoreUrlRequest
|
|
{
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function rules()
|
|
{
|
|
$user = auth('backend')->user();
|
|
|
|
$rules = [
|
|
'value' => 'required|string|max:255',
|
|
'title' => 'required|string|min:3|max:255',
|
|
'brand_id' => [
|
|
'required',
|
|
'integer',
|
|
'exists:App\Models\Brand,id',
|
|
!$user->role->equals(RoleEnum::conceptor) ? Rule::in($user->brands->pluck('id')) : ''
|
|
],
|
|
'image_settings' => 'required|json',
|
|
];
|
|
|
|
return \array_merge(
|
|
$rules,
|
|
$this->pictureRules('logo', 100, 100, 500, 500, true),
|
|
);
|
|
}
|
|
}
|