Projects/3BIT/winter-semester/IIS/xnecasr00/app/Http/Requests/UpdateGrapeVarietyRequest.php
2026-04-14 19:28:46 +02:00

49 lines
1.4 KiB
PHP

<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class UpdateGrapeVarietyRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
// TODO: Implement authorization logic (check if user has permission to update grape varieties)
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'variety_name' => ['required', 'string', 'max:255', Rule::unique('grape_varieties', 'variety_name')->ignore($this->grapeVariety)],
'description' => ['nullable', 'string'],
'origin' => ['nullable', 'string', 'max:255'],
'wine_type' => ['nullable', 'in:red,white,rose'],
'characteristics' => ['nullable', 'string'],
'image_url' => ['nullable', 'url', 'max:500'],
];
}
/**
* Get custom attribute names for validator errors.
*
* @return array<string, string>
*/
public function attributes(): array
{
return [
'variety_name' => 'variety name',
'wine_type' => 'wine type',
'image_url' => 'image URL',
];
}
}