insert(array_merge($attributes, [ 'created_at' => $now, 'updated_at' => $now, ])); return $attributes['id']; } public function find(string $id, bool $includeDeleted = false): ?stdClass { $query = DB::table('stored_files')->where('id', $id); if (! $includeDeleted) { $query->whereNull('deleted_at'); } return $query->first(); } public function archive(string $id): void { DB::table('stored_files')->where('id', $id)->whereNull('deleted_at')->update([ 'archived_at' => Carbon::now(), 'updated_at' => Carbon::now(), ]); } public function softDelete(string $id): void { DB::table('stored_files')->where('id', $id)->whereNull('deleted_at')->update([ 'deleted_from_storage_at' => Carbon::now(), 'deleted_at' => Carbon::now(), 'updated_at' => Carbon::now(), ]); } }