2015-12-13 04:42:28 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\API;
|
|
|
|
|
|
|
|
use App\Facades\Media;
|
|
|
|
use App\Http\Requests\API\SettingRequest;
|
|
|
|
use App\Models\Setting;
|
|
|
|
|
|
|
|
class SettingController extends Controller
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Save the application settings.
|
|
|
|
*
|
|
|
|
* @param SettingRequest $request
|
|
|
|
*
|
|
|
|
* @return \Illuminate\Http\JsonResponse
|
|
|
|
*/
|
2016-05-30 05:50:59 +00:00
|
|
|
public function store(SettingRequest $request)
|
2015-12-13 04:42:28 +00:00
|
|
|
{
|
|
|
|
// For right now there's only one setting to be saved
|
|
|
|
Setting::set('media_path', rtrim(trim($request->input('media_path')), '/'));
|
|
|
|
|
|
|
|
// In a next version we should opt for a "MediaPathChanged" event,
|
|
|
|
// but let's just do this async now.
|
|
|
|
Media::sync();
|
|
|
|
|
|
|
|
return response()->json();
|
|
|
|
}
|
|
|
|
}
|