mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-09-04 19:55:05 +02:00
59 lines
1.2 KiB
PHP
59 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Contracts\Repositories;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Support\Collection;
|
|
|
|
/**
|
|
* Interface RepositoryInterface.
|
|
*
|
|
* @template TModel of \App\Models\BaseModel
|
|
*/
|
|
interface RepositoryInterface
|
|
{
|
|
/**
|
|
* Get models from the repository.
|
|
*
|
|
* @param array $columns
|
|
* @return Collection
|
|
*/
|
|
public function get(array $columns = ['*']): Collection;
|
|
|
|
/**
|
|
* Save model to the repository.
|
|
*
|
|
* @param Model $model
|
|
* @return bool
|
|
*/
|
|
public function save(Model $model): bool;
|
|
|
|
/**
|
|
* Delete model from the repository.
|
|
*
|
|
* @param Model $model
|
|
* @return bool
|
|
*/
|
|
public function delete(Model $model): bool;
|
|
|
|
/**
|
|
* Update model in the repository.
|
|
*
|
|
* @param Model $model
|
|
* @param array $attributes
|
|
* @return bool
|
|
*/
|
|
public function update(Model $model, array $attributes): bool;
|
|
|
|
/**
|
|
* Filter repository models.
|
|
*
|
|
* @param string $filter
|
|
* @param mixed $value
|
|
* @return void
|
|
*/
|
|
public function handleFilter(string $filter, mixed $value = null): void;
|
|
}
|