koel/app/Repositories/SongRepository.php

31 lines
611 B
PHP
Raw Normal View History

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;
public function __construct(HelperService $helperService)
2018-08-29 06:15:11 +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
}
}