model ->where('console_id', $consoleId) ->with('romFiles') ->orderBy('title') ->paginate($perPage); } public function getBySlug(string $slug): ?Game { return $this->model ->with(['console', 'romFiles']) ->where('slug', $slug) ->first(); } public function getRecent(int $limit = 10): Collection { return $this->model ->with('console') ->latest() ->take($limit) ->get(); } public function search(string $query): Collection { return $this->model ->with('console') ->where('title', 'like', "%{$query}%") ->orderBy('title') ->get(); } public function getAll() { return $this->model ->with('console') ->orderBy('title') ->paginate(24); } public function create(array $data): Game { return $this->model->create($data); } public function firstOrCreate(array $conditions, array $values = []): Game { return $this->model->firstOrCreate($conditions, $values); } public function count(): int { return $this->model->count(); } }