'required|string|min:3|max:255', 'author' => 'required|string|min:3|max:50', 'categories' => 'nullable|string', 'release_date' => 'required|date:Y-m-d', 'update_date' => 'nullable|date:Y-m-d', 'image_small' => 'nullable|string', 'image_medium' => 'nullable|string', 'image_large' => 'nullable|string', 'project_url' => 'nullable|string', 'project_version' => 'nullable|string', 'description' => 'required|string|min:3', 'visible' => 'required|boolean' ]; } protected function prepareForValidation(): void { $this->merge([ 'visible' => $this->toBoolean($this->visible), ]); } private function toBoolean($booleable): bool { return filter_var($booleable, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); } }