koel/app/Http/Controllers/API/Interaction/BatchLikeController.php
2018-08-18 14:27:44 +02:00

37 lines
973 B
PHP

<?php
namespace App\Http\Controllers\API\Interaction;
use App\Http\Requests\API\BatchInteractionRequest;
use Illuminate\Http\JsonResponse;
class BatchLikeController extends Controller
{
/**
* Like several songs at once as the currently authenticated user.
*
* @param BatchInteractionRequest $request
*
* @return JsonResponse
*/
public function store(BatchInteractionRequest $request)
{
$interactions = $this->interactionService->batchLike((array) $request->songs, $request->user());
return response()->json($interactions);
}
/**
* Unlike several songs at once as the currently authenticated user.
*
* @param BatchInteractionRequest $request
*
* @return JsonResponse
*/
public function destroy(BatchInteractionRequest $request)
{
$this->interactionService->batchUnlike((array) $request->songs, $request->user());
return response()->json();
}
}