ldc-qrcollector-back/app/Http/Requests/Bo/Urls/UpdateUrlRequest.php

42 lines
792 B
PHP
Raw Permalink Normal View History

2023-03-28 14:37:49 +00:00
<?php
namespace App\Http\Requests\Bo\Urls;
2026-04-08 15:06:41 +02:00
use Illuminate\Validation\Rule;
2023-03-28 14:37:49 +00:00
class UpdateUrlRequest extends StoreUrlRequest
{
/**
* Prepare the data for validation.
* @return void
*/
protected function prepareForValidation(): void
{
$this->merge([
'key' => $this->url->key,
]);
}
2023-03-28 14:37:49 +00:00
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$rules = [
'key' => [
2026-04-08 15:06:41 +02:00
'required',
'string',
'max:45',
Rule::unique('urls', 'key')->ignore($this->url->id)
2026-04-08 15:06:41 +02:00
],
2023-03-28 14:37:49 +00:00
];
return \array_merge(
parent::rules(),
2023-03-28 14:37:49 +00:00
$rules,
);
}
}