koel/app/Http/Controllers/API/Interaction/LikeController.php

23 lines
605 B
PHP
Raw Normal View History

2017-08-06 09:43:59 +00:00
<?php
namespace App\Http\Controllers\API\Interaction;
2022-07-29 06:47:10 +00:00
use App\Http\Controllers\Controller;
use App\Http\Requests\API\SongLikeRequest;
2022-07-29 06:47:10 +00:00
use App\Models\User;
use App\Services\InteractionService;
use Illuminate\Contracts\Auth\Authenticatable;
2017-08-06 09:43:59 +00:00
class LikeController extends Controller
{
2022-07-29 06:47:10 +00:00
/** @param User $user */
public function __construct(private InteractionService $interactionService, private ?Authenticatable $user)
{
}
public function store(SongLikeRequest $request)
2017-08-06 09:43:59 +00:00
{
2022-06-10 10:47:46 +00:00
return response()->json($this->interactionService->toggleLike($request->song, $this->user));
2017-08-06 09:43:59 +00:00
}
}