Something went wrong. Try again.
Store your seeds
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950<?php
declare(strict_types=1);
namespace App\Http\Requests;
use App\Enums\SeedSpecies;use Illuminate\Contracts\Validation\ValidationRule;use Illuminate\Foundation\Http\FormRequest;use Illuminate\Validation\Rule;
class SeedRequest extends FormRequest{ /** * Determine if the user is authorized to make this request. */ public function authorize(): bool { return true; }
/** * Get the validation rules that apply to the request. * * @return array<string, ValidationRule|array<mixed>|string> */ public function rules(): array { return [ 'name' => ['required', 'string', 'min:5', 'max:255'], 'species' => ['required', Rule::enum(SeedSpecies::class)], 'essence' => ['nullable', 'string'], 'sprouts' => ['nullable', 'array'], 'sprouts.*' => ['url', 'distinct'], 'efforts' => ['nullable', 'array'], 'efforts.*.description' => ['string', 'distinct', 'max:255'], 'efforts.*.sown' => ['boolean'], ]; }
public function messages(): array { return [ 'sprouts.*.url' => 'Please provide a valid url', 'sprouts.*.distinct' => 'Please remove any duplicate sprouts', 'efforts.*.description.distinct' => 'Please remove any duplicate efforts', ]; }}