koel/app/Observers/SongObserver.php
2018-08-29 14:58:59 +07:00

21 lines
388 B
PHP

<?php
namespace App\Observers;
use App\Models\Song;
use App\Services\HelperService;
class SongObserver
{
private $helperService;
public function __construct(HelperService $helperService)
{
$this->helperService = $helperService;
}
public function creating(Song $song): void
{
$song->id = $this->helperService->getFileHash($song->path);
}
}