koel/app/Repositories/SongRepository.php
2018-08-29 13:15:11 +07:00

28 lines
606 B
PHP

<?php
namespace App\Repositories;
use App\Models\Song;
use App\Services\HelperService;
use Illuminate\Contracts\Auth\Guard;
class SongRepository extends AbstractRepository
{
private $helperService;
public function __construct(Guard $auth, HelperService $helperService)
{
parent::__construct($auth);
$this->helperService = $helperService;
}
public function getModelClass(): string
{
return Song::class;
}
public function getOneByPath(string $path): ?Song
{
return $this->getOneById($this->helperService->getFileHash($path));
}
}