description ?? ''; } public static function getTags($id) { $model = self::get($id) ?? false; return $model ? $model->tags->toArray() : false; } public static function getFull($id) { $specie = self::get($id); $data = $specie->toArray(); $data['tags'] = self::getTagsBySpecie($specie); return $data; } public static function getTagsBySpecie($specie) { return Tag::getTagsByModel($specie); } public static function get($id) { return Specie::with('tags.tag_group')->find($id); } public static function storeFull($data) { $images = $data['images'] ?? false; $tags = $data['tags'] ?? false; unset($data['images']); unset($data['tags']); $specie = self::store($data); self::storeImages($specie, $images); self::storeTags($specie, $tags); return $specie; } public static function storeTags($specie, $tags) { return Tag::storeTags($specie, $tags); } public static function exportExcel() { return Excel::download(new SpeciesExport(), 'species.xlsx'); } public static function getModel() { return Specie::query(); } }