mirror of
https://github.com/koel/koel
synced 2024-12-23 19:13:06 +00:00
29 lines
701 B
PHP
29 lines
701 B
PHP
<?php
|
|
|
|
namespace App\Jobs;
|
|
|
|
use App\Models\Song;
|
|
use App\Models\User;
|
|
use App\Services\LastfmService;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
class ScrobbleJob implements ShouldQueue
|
|
{
|
|
use Dispatchable;
|
|
use InteractsWithQueue;
|
|
use Queueable;
|
|
use SerializesModels;
|
|
|
|
public function __construct(public User $user, public Song $song, public int $timestamp)
|
|
{
|
|
}
|
|
|
|
public function handle(LastfmService $lastfmService): void
|
|
{
|
|
$lastfmService->scrobble($this->song, $this->user, $this->timestamp);
|
|
}
|
|
}
|