mirror of
https://github.com/koel/koel
synced 2024-12-22 02:23:14 +00:00
29 lines
785 B
PHP
29 lines
785 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\Repositories\SongRepository;
|
|
use App\Services\SongService;
|
|
use Illuminate\Contracts\Auth\Authenticatable;
|
|
|
|
class MakeSongsPublicController extends Controller
|
|
{
|
|
/** @param User $user */
|
|
public function __invoke(
|
|
ChangeSongsVisibilityRequest $request,
|
|
SongRepository $repository,
|
|
SongService $songService,
|
|
Authenticatable $user
|
|
) {
|
|
$songs = Song::query()->findMany($request->songs);
|
|
$songs->each(fn ($song) => $this->authorize('own', $song));
|
|
|
|
$songService->makeSongsPublic($songs);
|
|
|
|
return response()->noContent();
|
|
}
|
|
}
|