45 lines
910 B
PHP
45 lines
910 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Bo\Urls;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Support\Str;
|
|
|
|
class UpdateUrlRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*
|
|
* @return boolean
|
|
*/
|
|
public function authorize()
|
|
{
|
|
return auth()->check();
|
|
}
|
|
|
|
/**
|
|
* Prepare the data for validation.
|
|
* @return void
|
|
*/
|
|
protected function prepareForValidation(): void
|
|
{
|
|
$this->merge([
|
|
'key' => Str::slug($this->key),
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
'key' => 'string',
|
|
'value' => 'string',
|
|
'brand' => 'integer|exists:App\Models\Brand,id',
|
|
'image_settings' => 'string'
|
|
];
|
|
}
|
|
}
|