2017-08-06 09:43:59 +00:00
|
|
|
<?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
|
|
|
|
*/
|
2017-08-06 09:50:52 +00:00
|
|
|
public function store(BatchInteractionRequest $request)
|
2017-08-06 09:43:59 +00:00
|
|
|
{
|
2018-08-18 12:27:26 +00:00
|
|
|
$interactions = $this->interactionService->batchLike((array) $request->songs, $request->user());
|
|
|
|
|
|
|
|
return response()->json($interactions);
|
2017-08-06 09:43:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unlike several songs at once as the currently authenticated user.
|
|
|
|
*
|
|
|
|
* @param BatchInteractionRequest $request
|
|
|
|
*
|
|
|
|
* @return JsonResponse
|
|
|
|
*/
|
|
|
|
public function destroy(BatchInteractionRequest $request)
|
|
|
|
{
|
2018-08-18 12:27:26 +00:00
|
|
|
$this->interactionService->batchUnlike((array) $request->songs, $request->user());
|
|
|
|
|
|
|
|
return response()->json();
|
2017-08-06 09:43:59 +00:00
|
|
|
}
|
|
|
|
}
|