mirror of
https://github.com/koel/koel
synced 2024-12-21 18:13:13 +00:00
30 lines
611 B
PHP
30 lines
611 B
PHP
<?php
|
|
|
|
namespace App\Repositories;
|
|
|
|
use App\Models\Song;
|
|
use App\Services\HelperService;
|
|
|
|
class SongRepository extends AbstractRepository
|
|
{
|
|
private $helperService;
|
|
|
|
public function __construct(HelperService $helperService)
|
|
{
|
|
parent::__construct();
|
|
$this->helperService = $helperService;
|
|
}
|
|
|
|
public function getModelClass(): string
|
|
{
|
|
return Song::class;
|
|
}
|
|
|
|
public function getOneByPath(string $path): ?Song
|
|
{
|
|
/** @var Song|null $song */
|
|
$song = $this->getOneById($this->helperService->getFileHash($path));
|
|
|
|
return $song;
|
|
}
|
|
}
|