mirror of
https://github.com/koel/koel
synced 2024-12-22 10:33:16 +00:00
26 lines
813 B
PHP
26 lines
813 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\API\Interaction;
|
|
|
|
use App\Events\PlaybackStarted;
|
|
use App\Http\Controllers\Controller;
|
|
use App\Http\Requests\API\Interaction\IncreasePlayCountRequest;
|
|
use App\Http\Resources\InteractionResource;
|
|
use App\Models\User;
|
|
use App\Services\InteractionService;
|
|
use Illuminate\Contracts\Auth\Authenticatable;
|
|
|
|
class HandlePlaybackStartedController extends Controller
|
|
{
|
|
/** @param User $user */
|
|
public function __invoke(
|
|
IncreasePlayCountRequest $request,
|
|
InteractionService $interactionService,
|
|
Authenticatable $user
|
|
) {
|
|
$interaction = $interactionService->increasePlayCount($request->song, $user);
|
|
event(new PlaybackStarted($interaction->song, $interaction->user));
|
|
|
|
return InteractionResource::make($interaction);
|
|
}
|
|
}
|