'required|string', 'name_ru' => 'required|string', 'image' => 'required|image', 'position' => 'nullable|integer' ]; } /** * @return array */ public function getName(): array { return [ 'uz' => $this->get('name_uz'), 'ru' => $this->get('name_ru') ]; } public function getPosition(): int|null { if ($this->position) { return $this->get('position'); } else { if (UsefulInfo::count() === 0) { return 0; } return UsefulInfo::max('position') + 1; } } }