2018-08-29 06:15:11 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Repositories;
|
|
|
|
|
|
|
|
use App\Models\Song;
|
2020-12-23 11:03:22 +00:00
|
|
|
use App\Repositories\Traits\Searchable;
|
2018-08-29 06:15:11 +00:00
|
|
|
use App\Services\HelperService;
|
|
|
|
|
|
|
|
class SongRepository extends AbstractRepository
|
|
|
|
{
|
2020-12-23 11:03:22 +00:00
|
|
|
use Searchable;
|
|
|
|
|
2018-08-29 06:15:11 +00:00
|
|
|
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();
|
2020-12-22 20:11:22 +00:00
|
|
|
|
2018-08-29 06:15:11 +00:00
|
|
|
$this->helperService = $helperService;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getOneByPath(string $path): ?Song
|
|
|
|
{
|
2020-09-13 22:04:07 +00:00
|
|
|
return $this->getOneById($this->helperService->getFileHash($path));
|
2018-08-29 06:15:11 +00:00
|
|
|
}
|
|
|
|
}
|