mirror of
https://github.com/koel/koel
synced 2024-12-12 21:52:28 +00:00
30 lines
807 B
PHP
30 lines
807 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\API;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Http\Requests\API\SettingRequest;
|
|
use App\Models\Setting;
|
|
use App\Models\User;
|
|
use App\Services\MediaScanner;
|
|
use App\Values\ScanConfiguration;
|
|
use Illuminate\Contracts\Auth\Authenticatable;
|
|
|
|
class SettingController extends Controller
|
|
{
|
|
/** @param User $user */
|
|
public function __construct(private MediaScanner $mediaSyncService, private ?Authenticatable $user)
|
|
{
|
|
}
|
|
|
|
public function update(SettingRequest $request)
|
|
{
|
|
$this->authorize('admin', User::class);
|
|
|
|
Setting::set('media_path', rtrim(trim($request->media_path), '/'));
|
|
|
|
$this->mediaSyncService->scan(ScanConfiguration::make(owner: $this->user, makePublic: true));
|
|
|
|
return response()->noContent();
|
|
}
|
|
}
|