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;
|
2017-12-09 18:34:27 +00:00
|
|
|
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)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-12-09 18:34:27 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|