build: initialize RetroHub with Laravel, Inertia, Vue, and Horizon
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Features\Consoles\Repositories;
|
||||
|
||||
use App\Features\Consoles\Models\Console;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
class ConsoleRepository
|
||||
{
|
||||
public function __construct(
|
||||
private Console $model
|
||||
) {}
|
||||
|
||||
public function getAll(): Collection
|
||||
{
|
||||
return $this->model->withCount('games')->orderBy('name')->get();
|
||||
}
|
||||
|
||||
public function getBySlug(string $slug): ?Console
|
||||
{
|
||||
return $this->model->where('slug', $slug)->first();
|
||||
}
|
||||
|
||||
public function getWithGamesCount(): Collection
|
||||
{
|
||||
return $this->model->withCount('games')->orderBy('name')->get();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user