2018-08-29 06:15:11 +00:00
|
|
|
<?php
|
|
|
|
|
2024-02-23 18:36:02 +00:00
|
|
|
namespace App\Repositories\Contracts;
|
2018-08-29 06:15:11 +00:00
|
|
|
|
2024-10-15 06:29:31 +00:00
|
|
|
use Illuminate\Database\Eloquent\Collection as EloquentCollection;
|
2018-08-29 06:15:11 +00:00
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2022-07-27 15:32:36 +00:00
|
|
|
use Illuminate\Support\Collection;
|
2018-08-29 06:15:11 +00:00
|
|
|
|
2024-10-15 06:29:31 +00:00
|
|
|
/** @template T of Model */
|
2018-08-29 06:15:11 +00:00
|
|
|
interface RepositoryInterface
|
|
|
|
{
|
2024-10-15 06:29:31 +00:00
|
|
|
/** @return T */
|
2024-01-01 20:38:41 +00:00
|
|
|
public function getOne($id): Model;
|
|
|
|
|
2024-10-15 06:29:31 +00:00
|
|
|
/** @return T */
|
|
|
|
public function getOneBy(array $params): Model;
|
|
|
|
|
|
|
|
/** @return T|null */
|
2024-01-01 20:38:41 +00:00
|
|
|
public function findOne($id): ?Model;
|
2018-08-29 06:15:11 +00:00
|
|
|
|
2024-10-15 06:29:31 +00:00
|
|
|
/** @return T|null */
|
|
|
|
public function findOneBy(array $params): ?Model;
|
|
|
|
|
|
|
|
/** @return Collection<array-key, T> */
|
2024-05-31 05:40:34 +00:00
|
|
|
public function getMany(array $ids, bool $preserveOrder = false): Collection;
|
2018-08-29 06:15:11 +00:00
|
|
|
|
2024-10-15 06:29:31 +00:00
|
|
|
/** @return Collection<int, T> */
|
|
|
|
public function getAll(): EloquentCollection;
|
|
|
|
|
|
|
|
/** @return T|null */
|
|
|
|
public function findFirstWhere(...$params): ?Model;
|
2018-08-29 06:15:11 +00:00
|
|
|
}
|