valideTyps)) { throw new \Exception("Invalide Typ for Access Log"); } $this->addAccessLog(null, null, $image->id, $typ, $file->getSize()); } public function addById(int $image_id, File $file, string $typ) { if(!in_array($typ, $this->valideTyps)) { throw new \Exception("Invalide Typ for Access Log"); } $this->addAccessLog(null, null, $image_id, $typ, $file->getSize()); } public function addComplete(\App\Models\Image $image, Gallery $gallery, Tenant $tenant, File $file, string $typ) { if(!in_array($typ, $this->valideTyps)) { throw new \Exception("Invalide Typ for Access Log"); } $this->addAccessLog($tenant->id, $gallery->id, $image->id, $typ, $file->getSize()); } private function addAccessLog(?int $tenant, ?int $gallery, int $image, string $typ, int $size) { $access = new \App\Models\Access(); $access->year = date("Y"); $access->month = date("m"); $access->day = date("d"); $access->hour = date("H"); $access->image = $image; $access->gallery = $gallery; $access->tenant = $tenant; $access->typ = $typ; $access->size = $size; $access->saveOrFail(); } }