mirror of
https://github.com/koel/koel
synced 2024-12-03 17:29:33 +00:00
28 lines
762 B
PHP
28 lines
762 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Http\Controllers\API;
|
||
|
|
||
|
use App\Http\Controllers\Controller;
|
||
|
use App\Http\Requests\API\InteractWithMultipleSongsRequest;
|
||
|
use App\Models\Song;
|
||
|
use App\Models\User;
|
||
|
use App\Services\InteractionService;
|
||
|
use Illuminate\Contracts\Auth\Authenticatable;
|
||
|
|
||
|
class UnlikeMultipleSongsController extends Controller
|
||
|
{
|
||
|
/** @param User $user */
|
||
|
public function __invoke(
|
||
|
InteractWithMultipleSongsRequest $request,
|
||
|
InteractionService $interactionService,
|
||
|
Authenticatable $user
|
||
|
) {
|
||
|
$songs = Song::query()->findMany($request->songs);
|
||
|
$songs->each(fn (Song $song) => $this->authorize('access', $song));
|
||
|
|
||
|
$interactionService->unlikeMany($songs, $user);
|
||
|
|
||
|
return response()->noContent();
|
||
|
}
|
||
|
}
|