koel/app/Repositories/SongRepository.php

28 lines
551 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
{
return $this->getOneById($this->helperService->getFileHash($path));
}
}