|
|
|
@ -41,6 +41,8 @@ class SettingController extends Controller |
|
|
|
|
public function store(Request $request) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->validate(\request(),[ |
|
|
|
|
'type' => 'required', |
|
|
|
|
'key' => 'required', |
|
|
|
@ -54,12 +56,12 @@ class SettingController extends Controller |
|
|
|
|
$setting->type = \request('type'); |
|
|
|
|
$setting->status = \request('status'); |
|
|
|
|
$setting->slug = Setting::create_slug(\request('key')); |
|
|
|
|
if(request('type') == array_search('Image',config('custom.setting_types'))){ |
|
|
|
|
$this->validate($request,[ |
|
|
|
|
'value'=>'required|file|mimes:jpeg,png,jpg,pdf' |
|
|
|
|
] |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// if(request('type') == array_search('Image',config('custom.setting_types'))){ |
|
|
|
|
// $this->validate($request,[ |
|
|
|
|
// 'value'=>'required|file|mimes:jpeg,png,jpg,pdf' |
|
|
|
|
// ] |
|
|
|
|
// ); |
|
|
|
|
// } |
|
|
|
|
if($request->hasFile('value')){ |
|
|
|
|
$extension = \request()->file('value')->getClientOriginalExtension(); |
|
|
|
|
$image_folder_type = array_search('setting',config('custom.image_folders')); //for image saved in folder |
|
|
|
@ -69,7 +71,7 @@ class SettingController extends Controller |
|
|
|
|
$setting->value = $image_path; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
else{ |
|
|
|
|
$setting->value = \request('value'); |
|
|
|
|
} |
|
|
|
|
$setting->save(); |
|
|
|
|