2018-08-29 06:15:11 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Repositories;
|
|
|
|
|
|
|
|
use App\Models\Song;
|
|
|
|
use App\Services\HelperService;
|
|
|
|
|
|
|
|
class SongRepository extends AbstractRepository
|
|
|
|
{
|
|
|
|
private $helperService;
|
|
|
|
|
2019-01-01 11:53:20 +00:00
|
|
|
public function __construct(HelperService $helperService)
|
2018-08-29 06:15:11 +00:00
|
|
|
{
|
2019-01-01 11:53:20 +00:00
|
|
|
parent::__construct();
|
2018-08-29 06:15:11 +00:00
|
|
|
$this->helperService = $helperService;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getModelClass(): string
|
|
|
|
{
|
|
|
|
return Song::class;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getOneByPath(string $path): ?Song
|
|
|
|
{
|
2019-06-30 14:22:53 +00:00
|
|
|
/** @var Song|null $song */
|
|
|
|
$song = $this->getOneById($this->helperService->getFileHash($path));
|
|
|
|
|
|
|
|
return $song;
|
2018-08-29 06:15:11 +00:00
|
|
|
}
|
|
|
|
}
|