koel/app/Http/Controllers/API/SettingController.php
2022-07-29 09:04:44 +02:00

26 lines
611 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\MediaSyncService;
class SettingController extends Controller
{
public function __construct(private MediaSyncService $mediaSyncService)
{
}
public function update(SettingRequest $request)
{
$this->authorize('admin', User::class);
Setting::set('media_path', rtrim(trim($request->media_path), '/'));
$this->mediaSyncService->sync();
return response()->noContent();
}
}