- Add base repository interfaces and abstract classes - Implement separated read/write repositories for Domain and Username models - Add intelligent query caching with automatic invalidation - Include cache management service and CLI commands - Add comprehensive configuration for cache TTL and monitoring - Enhance performance through optimized data access patterns
46 lines
1.3 KiB
PHP
46 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Repositories\Contracts;
|
|
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
interface WriteRepositoryInterface
|
|
{
|
|
public function create(array $data): Model;
|
|
|
|
public function createMany(array $data): Collection;
|
|
|
|
public function update(Model $model, array $data): bool;
|
|
|
|
public function updateById(int $id, array $data): bool;
|
|
|
|
public function upsert(array $data, array|string $uniqueBy, ?array $update = null): Collection;
|
|
|
|
public function delete(Model $model): bool;
|
|
|
|
public function deleteById(int $id): bool;
|
|
|
|
public function deleteMultiple(array $ids): int;
|
|
|
|
public function restore(Model $model): bool;
|
|
|
|
public function restoreById(int $id): bool;
|
|
|
|
public function forceDelete(Model $model): bool;
|
|
|
|
public function forceDeleteById(int $id): bool;
|
|
|
|
public function sync(Model $model, string $relation, array $ids, bool $detaching = true): array;
|
|
|
|
public function attach(Model $model, string $relation, array $ids, array $attributes = [], bool $touch = true): void;
|
|
|
|
public function detach(Model $model, string $relation, ?array $ids = null, bool $touch = true): int;
|
|
|
|
public function clearCache(): void;
|
|
|
|
public function clearCacheForModel(Model $model): void;
|
|
|
|
public function clearCacheForCollection(Collection $models): void;
|
|
}
|