*/ public function rules(): array { $member = $this->route('member'); $creating = ! $member instanceof Member; $sometimes = $creating ? 'required' : 'sometimes'; return [ 'name' => [$sometimes, 'string', 'max:255'], 'slug' => [ $sometimes, 'string', 'max:255', 'alpha_dash:ascii', Rule::unique('members', 'slug')->ignore($member?->id), ], 'headline' => ['sometimes', 'nullable', new Translatable(max: 255)], 'bio' => ['sometimes', 'nullable', new Translatable], 'avatar' => ['sometimes', 'nullable', 'string', 'max:2048'], // Never shown on the site; the panel keeps it for the collective. 'email' => ['sometimes', 'nullable', 'email', 'max:255'], 'github_username' => ['sometimes', 'nullable', 'string', 'max:120'], 'links' => ['sometimes', 'nullable', 'array', 'max:10'], 'links.*' => ['nullable', 'url', 'max:2048'], 'is_public' => ['sometimes', 'boolean'], 'is_founder' => ['sometimes', 'boolean'], 'joined_at' => ['sometimes', 'nullable', 'date'], 'left_at' => ['sometimes', 'nullable', 'date', 'after_or_equal:joined_at'], 'position' => ['sometimes', 'integer', 'min:0'], 'technology_ids' => ['sometimes', 'array'], 'technology_ids.*' => ['integer', 'distinct', Rule::exists('technologies', 'id')], ]; } }