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