/
mitallic
/
HHProfileUser
Обзор
Документация
Войти
/
mitallic
/
HHProfileUser
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
app/Repositories/Repository.php
44 строки
763 B
Steaves Whois
init
28 май 2025, 13:58
28 май 2025, 13:58
7a2bc65
Код
Авторство
О чём код?
<?php declare(strict_types=1); namespace App\Repositories; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Collection; class Repository { /** * @var Model */ protected Model $model; /** * @param int $id * @return Model */ public function findById(int $id): Model { return $this->model->findOrFail($id); } /** * @return Collection */ public function getAll(): Collection { return $this->model->all(); } /** * @param array $data * @return Model */ public function create(array $data): Model { $this->model->fill($data); $this->model->save(); $this->model->fresh(); return $this->model; } }