mirror of
https://github.com/koel/koel
synced 2024-12-12 13:42:27 +00:00
35 lines
915 B
PHP
35 lines
915 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Http\Controllers\API\Interaction;
|
||
|
|
||
|
use App\Http\Requests\API\BatchInteractionRequest;
|
||
|
use App\Models\Interaction;
|
||
|
use Illuminate\Http\JsonResponse;
|
||
|
|
||
|
class BatchLikeController extends Controller
|
||
|
{
|
||
|
/**
|
||
|
* Like several songs at once as the currently authenticated user.
|
||
|
*
|
||
|
* @param BatchInteractionRequest $request
|
||
|
*
|
||
|
* @return JsonResponse
|
||
|
*/
|
||
|
function store(BatchInteractionRequest $request)
|
||
|
{
|
||
|
return response()->json(Interaction::batchLike((array) $request->songs, $request->user()));
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Unlike several songs at once as the currently authenticated user.
|
||
|
*
|
||
|
* @param BatchInteractionRequest $request
|
||
|
*
|
||
|
* @return JsonResponse
|
||
|
*/
|
||
|
public function destroy(BatchInteractionRequest $request)
|
||
|
{
|
||
|
return response()->json(Interaction::batchUnlike((array) $request->songs, $request->user()));
|
||
|
}
|
||
|
}
|