mirror of
https://github.com/koel/koel
synced 2024-12-25 03:53:05 +00:00
24 lines
687 B
PHP
24 lines
687 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\API;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Http\Requests\API\ChangeSongsVisibilityRequest;
|
|
use App\Models\Song;
|
|
use App\Models\User;
|
|
use App\Services\SongService;
|
|
use Illuminate\Contracts\Auth\Authenticatable;
|
|
|
|
class PublicizeSongsController extends Controller
|
|
{
|
|
/** @param User $user */
|
|
public function __invoke(ChangeSongsVisibilityRequest $request, SongService $songService, Authenticatable $user)
|
|
{
|
|
$songs = Song::query()->findMany($request->songs);
|
|
$songs->each(fn ($song) => $this->authorize('own', $song));
|
|
|
|
$songService->markSongsAsPublic($songs);
|
|
|
|
return response()->noContent();
|
|
}
|
|
}
|