user()->isAdmin(); } public function rules(): array { $lieuId = $this->route('lieu')->id; return [ 'nom' => ['required', 'string', 'max:255'], 'code' => ['nullable', 'string', 'max:20'], // Interdit de se choisir soi-même ou un descendant comme parent 'lieu_parent_id'=> ['nullable', 'integer', 'exists:lieux,id', "not_in:{$lieuId}"], 'latitude' => ['nullable', 'numeric', 'between:-90,90'], 'longitude' => ['nullable', 'numeric', 'between:-180,180'], 'note' => ['nullable', 'string'], ]; } }