mirror of
https://github.com/koel/koel
synced 2024-11-24 21:23:06 +00:00
39 lines
966 B
PHP
39 lines
966 B
PHP
<?php
|
|
|
|
namespace App\Jobs;
|
|
|
|
use App\Models\Interaction;
|
|
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 LoveTrackOnLastfmJob implements ShouldQueue
|
|
{
|
|
use Dispatchable;
|
|
use InteractsWithQueue;
|
|
use Queueable;
|
|
use SerializesModels;
|
|
|
|
private $user;
|
|
private $interaction;
|
|
|
|
public function __construct(User $user, Interaction $interaction)
|
|
{
|
|
$this->user = $user;
|
|
$this->interaction = $interaction;
|
|
}
|
|
|
|
public function handle(LastfmService $lastfmService): void
|
|
{
|
|
$lastfmService->toggleLoveTrack(
|
|
$this->interaction->song->title,
|
|
$this->interaction->song->artist->name,
|
|
$this->user->lastfm_session_key,
|
|
$this->interaction->liked
|
|
);
|
|
}
|
|
}
|