33 lines
634 B
PHP
33 lines
634 B
PHP
<?php
|
|
|
|
namespace App\Features\Games\Repositories;
|
|
|
|
use App\Features\Games\Models\RomFile;
|
|
|
|
class RomFileRepository
|
|
{
|
|
public function __construct(
|
|
private RomFile $model
|
|
) {}
|
|
|
|
public function count(): int
|
|
{
|
|
return $this->model->count();
|
|
}
|
|
|
|
public function findByHash(string $hash): ?RomFile
|
|
{
|
|
return $this->model->where('file_hash', $hash)->first();
|
|
}
|
|
|
|
public function create(array $data): RomFile
|
|
{
|
|
return $this->model->create($data);
|
|
}
|
|
|
|
public function getByGame(int $gameId)
|
|
{
|
|
return $this->model->where('game_id', $gameId)->get();
|
|
}
|
|
}
|