Files
animethemes-server/app/Contracts/Repositories/RepositoryInterface.php
T
paranarimasu 4258e0727d Seed audios (#426)
* feat: initial implementation of audio resource

* chore: bump dependencies
2022-07-30 21:14:29 -05:00

68 lines
1.4 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;
/**
* Validate repository filter.
*
* @param string $filter
* @param mixed $value
* @return bool
*/
public function validateFilter(string $filter, mixed $value = null): bool;
/**
* Filter repository models.
*
* @param string $filter
* @param mixed $value
* @return void
*/
public function handleFilter(string $filter, mixed $value = null): void;
}