Viewing file: ThemeController.php (42.78 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request; use App\Models\Settings;
class ThemeController extends Controller { public function index(){ return view('admin.theme.index'); } public function sign_up_index(){ return view('admin.signupinfo.create'); } public function omug_index(){ return view('admin.omug.create'); } public function training_and_intership(){ return view('admin.training_and_intership.create'); } public function teams_index(){ return view('admin.teams.create'); } public function fees_index(){ return view('admin.fees.create'); } public function courses_index(){ return view('admin.courses.create'); } public function services_index(){ return view('admin.services.header'); } public function home_section(){ return view('admin.home_section.create'); } public function sign_up_info(Request $request){ if (env("APP_DEMO")){ return redirect()->back()->withErrors(['msg' => trans('admin.app_demo_message')]); }
$data = ['name' => 'sign_up_info']; $setting = auth()->user()->settings()->firstOrNew($data); $setting->value = json_encode($request->only('title','short_description','description')); $setting->save();
cache()->flush(); return redirect()->back()->with('success','Sign Up Info Theme successfully update'); }
public function about_section(){ return view('admin.about_section.create'); }
public function blog_section(){ return view('admin.blog_management.index'); } public function publication_section(){ return view('admin.publication_section.index'); }
public function publication_section_store(Request $request){ if (env("APP_DEMO")){ return redirect()->back()->withErrors(['msg' => trans('admin.app_demo_message')]); }
$data = ['name' => 'publication_section']; $setting = auth()->user()->settings()->firstOrNew($data); $setting->value = json_encode($request->only('title','short_description')); $setting->save();
cache()->flush(); return redirect()->back()->with('success','Publication Section successfully update'); } public function blog_section_store(Request $request){ if (env("APP_DEMO")){ return redirect()->back()->withErrors(['msg' => trans('admin.app_demo_message')]); }
$data = ['name' => 'blog_section']; $setting = auth()->user()->settings()->firstOrNew($data); $setting->value = json_encode($request->only('title','short_description')); $setting->save();
cache()->flush(); return redirect()->back()->with('success','Blog Section successfully update'); }
public function about_section_store(Request $request){ $about_sections = json_decode(get_settings('about_section')); $cv_section = isset($about_sections->cv_sections)?$about_sections->cv_sections:[]; $cv_sections = []; if($request->hasFile('about_image')){ if (isset($request->pre_image) && !empty($request->pre_image)) { $oldImagePath = public_path('/uploads') . '/' . $request->pre_image; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file=$request->file('about_image'); $about_image=time().'imo'.'.'.$file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $about_image); $request['image']=$about_image; }else{ $request['image']=$request->pre_image; } if($request->hasFile('download_file')){ if (isset($request->pre_download_file) && !empty($request->pre_download_file)) { $oldImagePath = public_path('/uploads') . '/' . $request->pre_download_file; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file=$request->file('download_file'); $about_image=time().'imo'.'.'.$file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $about_image); $request['file']=$about_image; }else{ $request['file']=$request->pre_download_file; } if ($request->years) { foreach ($request->years as $key => $value) { $cv_sections[] = [ 'year' => isset($value)?$value:'', 'short_description' => isset($request->short_description[$key])?$request->short_description[$key]:'' ]; } }else{ $cv_sections = isset($cv_section)?$cv_section:[]; } $request['cv_sections'] = $cv_sections; $data = ['name' => 'about_section']; $setting = auth()->user()->settings()->firstOrNew($data); $setting->value = json_encode($request->only('title','sub_title','description','image','cv_sections','file')); $setting->save(); cache()->flush(); return redirect()->back()->with('success','Training And Intership Theme successfully update'); }
public function training_and_intership_store(Request $request){ if (env("APP_DEMO")){ return redirect()->back()->withErrors(['msg' => trans('admin.app_demo_message')]); }
$data = ['name' => 'training_and_intership']; $setting = auth()->user()->settings()->firstOrNew($data); $setting->value = json_encode($request->only('title','sub_title','description')); $setting->save(); cache()->flush(); return redirect()->back()->with('success','Training And Intership Theme successfully update'); }
public function teaching(){ return view('admin.teaching.create'); } public function video_content(){ return view('admin.video_content.create'); } public function video_upload(){ return view('admin.video_content.video'); }
public function video_content_store(Request $request){ if (env("APP_DEMO")){ return redirect()->back()->withErrors(['msg' => trans('admin.app_demo_message')]); }
unset($request['_token']);
if($request->type=='profesional'){ $data = ['name' => 'profesional_video_section']; $setting = auth()->user()->settings()->firstOrNew($data); $setting->value = json_encode($request->all()); $setting->save(); }else if($request->type=='varsity_section'){ $data = ['name' => 'varsity_video_section']; $setting = auth()->user()->settings()->firstOrNew($data); $setting->value = json_encode($request->all()); $setting->save(); }else if($request->type=='hsc_section'){ $data = ['name' => 'hsc_video_section']; $setting = auth()->user()->settings()->firstOrNew($data); $setting->value = json_encode($request->all()); $setting->save(); }
cache()->flush(); return redirect()->back()->with('success','Video Section successfully update'); }
public function photoGallery(){ return view('admin.photo_gallery.index'); }
public function photoGalleryStore(Request $request){ if (env("APP_DEMO")){ return redirect()->back()->withErrors(['msg' => trans('admin.app_demo_message')]); }
unset($request['_token']);
if($request->type=='others'){
if($request->hasFile('others_video_one')){ if (isset($request->edit_others_video_one) && !empty($request->edit_others_video_one)) { $oldImagePath = public_path('/uploads') . '/' . $request->edit_others_video_one; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file=$request->file('others_video_one'); $omug_image=time().'o1'.'.'.$file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $omug_image); $request['others_photo_one']=$omug_image; }else{ $request['others_photo_one']=$request->edit_others_video_one; }
if($request->hasFile('others_video_two')){ if (isset($request->edit_others_video_two) && !empty($request->edit_others_video_two)) { $oldImagePath = public_path('/uploads') . '/' . $request->edit_others_video_two; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file=$request->file('others_video_two'); $omug_image=time().'o2'.'.'.$file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $omug_image); $request['others_photo_two']=$omug_image; }else{ $request['others_photo_two']=$request->edit_others_video_two; }
if($request->hasFile('others_video_three')){ if (isset($request->edit_others_video_three) && !empty($request->edit_others_video_three)) { $oldImagePath = public_path('/uploads') . '/' . $request->edit_others_video_three; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file=$request->file('others_video_three'); $omug_image=time().'o3'.'.'.$file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $omug_image); $request['others_photo_three']=$omug_image; }else{ $request['others_photo_three']=$request->edit_others_video_three; }
if($request->hasFile('others_video_four')){ if (isset($request->edit_others_video_four) && !empty($request->edit_others_video_four)) { $oldImagePath = public_path('/uploads') . '/' . $request->edit_others_video_four; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file=$request->file('others_video_four'); $omug_image=time().'o4'.'.'.$file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $omug_image); $request['others_photo_four']=$omug_image; }else{ $request['others_photo_four']=$request->edit_others_video_four; }
if($request->hasFile('others_video_five')){ if (isset($request->edit_others_video_four) && !empty($request->edit_others_video_five)) { $oldImagePath = public_path('/uploads') . '/' . $request->edit_others_video_five; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file=$request->file('others_video_five'); $omug_image=time().'o5'.'.'.$file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $omug_image); $request['others_photo_five']=$omug_image; }else{ $request['others_photo_five']=$request->edit_others_video_five; }
if($request->hasFile('others_video_six')){ if (isset($request->edit_others_video_four) && !empty($request->edit_others_video_six)) { $oldImagePath = public_path('/uploads') . '/' . $request->edit_others_video_six; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file=$request->file('others_video_six'); $omug_image=time().'o6'.'.'.$file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $omug_image); $request['others_photo_six']=$omug_image; }else{ $request['others_photo_six']=$request->edit_others_video_six; }
$data = ['name' => 'others_video_section']; $setting = auth()->user()->settings()->firstOrNew($data); $setting->value = json_encode($request->only('others_photo_one','others_photo_two','others_photo_three','others_photo_four','others_photo_five','others_photo_six', 'others_desc_one','others_desc_two','others_desc_three','others_desc_four','others_desc_five','others_desc_six')); $setting->save(); }else if($request->type=='travel'){
if($request->hasFile('travel_video_one')){ if (isset($request->edit_travel_video_one) && !empty($request->edit_travel_video_one)) { $oldImagePath = public_path('/uploads') . '/' . $request->edit_travel_video_one; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file=$request->file('travel_video_one'); $omug_image=time().'t1'.'.'.$file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $omug_image); $request['travel_photo_one']=$omug_image; }else{ $request['travel_photo_one']=$request->edit_travel_video_one; }
if($request->hasFile('travel_video_two')){ if (isset($request->edit_travel_video_two) && !empty($request->edit_travel_video_two)) { $oldImagePath = public_path('/uploads') . '/' . $request->edit_travel_video_two; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file=$request->file('travel_video_two'); $omug_image=time().'t2'.'.'.$file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $omug_image); $request['travel_photo_two']=$omug_image; }else{ $request['travel_photo_two']=$request->edit_travel_video_two; }
if($request->hasFile('travel_video_three')){ if (isset($request->edit_travel_video_three) && !empty($request->edit_travel_video_three)) { $oldImagePath = public_path('/uploads') . '/' . $request->edit_travel_video_three; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file=$request->file('travel_video_three'); $omug_image=time().'t3'.'.'.$file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $omug_image); $request['travel_photo_three']=$omug_image; }else{ $request['travel_photo_three']=$request->edit_travel_video_three; }
if($request->hasFile('travel_video_four')){ if (isset($request->edit_travel_video_four) && !empty($request->edit_travel_video_four)) { $oldImagePath = public_path('/uploads') . '/' . $request->edit_travel_video_four; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file=$request->file('travel_video_four'); $omug_image=time().'t4'.'.'.$file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $omug_image); $request['travel_photo_four']=$omug_image; }else{ $request['travel_photo_four']=$request->edit_travel_video_four; }
if($request->hasFile('travel_video_five')){ if (isset($request->edit_travel_video_five) && !empty($request->edit_travel_video_five)) { $oldImagePath = public_path('/uploads') . '/' . $request->edit_travel_video_five; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file=$request->file('travel_video_five'); $omug_image=time().'t4'.'.'.$file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $omug_image); $request['travel_photo_five']=$omug_image; }else{ $request['travel_photo_five']=$request->edit_travel_video_five; }
if($request->hasFile('travel_video_six')){ if (isset($request->edit_travel_video_six) && !empty($request->edit_travel_video_six)) { $oldImagePath = public_path('/uploads') . '/' . $request->edit_travel_video_six; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file=$request->file('travel_video_six'); $omug_image=time().'t4'.'.'.$file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $omug_image); $request['travel_photo_six']=$omug_image; }else{ $request['travel_photo_six']=$request->edit_travel_video_six; }
$data = ['name' => 'travel_video_section']; $setting = auth()->user()->settings()->firstOrNew($data); $setting->value = json_encode($request->only('travel_photo_one','travel_photo_two','travel_photo_three','travel_photo_four','travel_photo_five','travel_photo_six', 'travel_desc_one','travel_desc_two','travel_desc_three','travel_desc_four','travel_desc_five')); $setting->save(); }else if($request->type=='teaching'){
if($request->hasFile('tc_video_one')){ if (isset($request->edit_tc_video_one) && !empty($request->edit_tc_video_one)) { $oldImagePath = public_path('/uploads') . '/' . $request->edit_tc_video_one; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file=$request->file('tc_video_one'); $omug_image=time().'p1'.'.'.$file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $omug_image); $request['tc_photo_one']=$omug_image; }else{ $request['tc_photo_one']=$request->edit_tc_video_one; }
if($request->hasFile('tc_video_two')){ if (isset($request->edit_tc_video_two) && !empty($request->edit_tc_video_two)) { $oldImagePath = public_path('/uploads') . '/' . $request->edit_tc_video_two; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file=$request->file('tc_video_two'); $omug_image=time().'p2'.'.'.$file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $omug_image); $request['tc_photo_two']=$omug_image; }else{ $request['tc_photo_two']=$request->edit_tc_video_two; }
if($request->hasFile('tc_video_three')){ if (isset($request->edit_tc_video_three) && !empty($request->edit_tc_video_three)) { $oldImagePath = public_path('/uploads') . '/' . $request->edit_tc_video_three; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file=$request->file('tc_video_three'); $omug_image=time().'p3'.'.'.$file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $omug_image); $request['tc_photo_three']=$omug_image; }else{ $request['tc_photo_three']=$request->edit_tc_video_three; }
if($request->hasFile('tc_video_four')){ if (isset($request->edit_tc_video_four) && !empty($request->edit_tc_video_four)) { $oldImagePath = public_path('/uploads') . '/' . $request->edit_tc_video_four; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file=$request->file('tc_video_four'); $omug_image=time().'p4'.'.'.$file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $omug_image); $request['tc_photo_four']=$omug_image; }else{ $request['tc_photo_four']=$request->edit_tc_video_four; }
if($request->hasFile('tc_video_five')){ if (isset($request->edit_tc_video_five) && !empty($request->edit_tc_video_five)) { $oldImagePath = public_path('/uploads') . '/' . $request->edit_tc_video_five; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file=$request->file('tc_video_five'); $omug_image=time().'p5'.'.'.$file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $omug_image); $request['tc_photo_five']=$omug_image; }else{ $request['tc_photo_five']=$request->edit_tc_video_five; }
if($request->hasFile('tc_video_six')){ if (isset($request->edit_tc_video_six) && !empty($request->edit_tc_video_six)) { $oldImagePath = public_path('/uploads') . '/' . $request->edit_tc_video_six; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file=$request->file('tc_video_six'); $omug_image=time().'p6'.'.'.$file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $omug_image); $request['tc_photo_six']=$omug_image; }else{ $request['tc_photo_six']=$request->edit_tc_video_six; }
$data = ['name' => 'teaching_video_section']; $setting = auth()->user()->settings()->firstOrNew($data); $setting->value = json_encode($request->only('tc_desc_one','tc_desc_two','tc_desc_three','tc_desc_four','tc_desc_five','tc_desc_six','tc_photo_one', 'tc_photo_two','tc_photo_three','tc_photo_four','tc_photo_five','tc_photo_six')); $setting->save();
}
cache()->flush(); return redirect()->back()->with('success','Photo Gallery Successfully Update'); }
public function teaching_store(Request $request){ if (env("APP_DEMO")){ return redirect()->back()->withErrors(['msg' => trans('admin.app_demo_message')]); }
$data = ['name' => 'teaching_section']; $setting = auth()->user()->settings()->firstOrNew($data); $setting->value = json_encode($request->only('title','sub_title','description','counter_one_title', 'counter_two_title','counter_three_title','counter_one_number','counter_two_number','counter_three_number')); $setting->save(); cache()->flush(); return redirect()->back()->with('success','Teaching Section successfully update'); }
public function activity_section(){ return view('admin.activity_section.create'); }
public function activity_store(Request $request){ if (env("APP_DEMO")){ return redirect()->back()->withErrors(['msg' => trans('admin.app_demo_message')]); } $activity_sections = json_decode(get_settings('activity_section')); $under_graduate_activity = isset($activity_sections->under_graduate_activity)?$activity_sections->under_graduate_activity:[]; $graduate_activity = isset($activity_sections->graduate_activity)?$activity_sections->graduate_activity:[]; $under_graduation_student_activity = []; $graduation_student_activity = []; if ($request->topics) { foreach ($request->topics as $key => $value) { $under_graduation_student_activity[] = [ 'topic' => isset($value)?$value:'', 'recomended' => isset($request->recomended[$key])?$request->recomended[$key]:'' ]; } }else{ $under_graduation_student_activity = isset($under_graduate_activity)?$under_graduate_activity:[]; }
if ($request->topics_for_graduates) { foreach ($request->topics_for_graduates as $key => $graduate_value) { $graduation_student_activity[] = [ 'graduate_activity_topic' => isset($graduate_value)?$graduate_value:'', 'graduate_activity_recomended' => isset($request->recomended_for_graduate[$key])?$request->recomended_for_graduate[$key]:'' ]; } }else{ $graduation_student_activity = isset($graduate_activity)?$graduate_activity:[]; } $request['under_graduate_activity'] = $under_graduation_student_activity; $request['graduate_activity'] = $graduation_student_activity; $data = ['name' => 'activity_section']; $setting = auth()->user()->settings()->firstOrNew($data);
$setting->value = json_encode($request->only('graduate_title','undergraduate_title','activity_title','activity_short_description','under_graduate_activity','graduate_activity')); $setting->save(); cache()->flush(); return redirect()->back()->with('success','Activity Section successfully update'); }
public function omug(Request $request){ if (env("APP_DEMO")){ return redirect()->back()->withErrors(['msg' => trans('admin.app_demo_message')]); }
if($request->hasFile('omug_image')){ if (isset($request->pre_image) && !empty($request->pre_image)) { $oldImagePath = public_path('/uploads') . '/' . $request->pre_image; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file=$request->file('omug_image'); $omug_image=time().'imo'.'.'.$file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $omug_image); $request['image']=$omug_image; }else{ $request['image']=$request->pre_image; }
$data = ['name' => 'omug']; $setting = auth()->user()->settings()->firstOrNew($data); $setting->value = json_encode($request->only('title','short_description','description','image','omug_youtube_link')); $setting->save();
cache()->flush(); return redirect()->back()->with('success','OMUG Theme successfully update'); } public function team(Request $request){ if (env("APP_DEMO")){ return redirect()->back()->withErrors(['msg' => trans('admin.app_demo_message')]); }
$team_data = []; if($request->name) { foreach ($request->name as $key => $name) {
$imagePath = ''; if (isset($request->pre_image[$key]) && $request->pre_image[$key]) { $imagePath = $request->pre_image[$key]; } else if (isset($request->image[$key]) && $request->image[$key]) { if (isset($request->pre_image[$key]) && !empty($request->pre_image[$key])) { $oldImagePath = public_path('/uploads') . '/' . $request->pre_image[$key]; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file = $request->file('image')[$key]; $imageName = time() . $key . '.' . $file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $imageName); $imagePath = $imageName; }
$team_data[] = [ 'name' => $name, 'work_title' => isset($request->work_title[$key]) ? $request->work_title[$key] : '', 'email' => isset($request->email[$key]) ? $request->email[$key] : '', 'image' => $imagePath, ]; } $request['team_data'] = $team_data; }
$data = ['name' => 'team']; $setting = auth()->user()->settings()->firstOrNew($data); $setting->value = json_encode($request->only('title','team_data')); $setting->save();
cache()->flush();
return redirect()->back()->with('success','Team Theme successfully updated'); } public function services_header(Request $request){ if (env("APP_DEMO")){ return redirect()->back()->withErrors(['msg' => trans('admin.app_demo_message')]); } $data = ['name' => 'services']; $setting = auth()->user()->settings()->firstOrNew($data); $setting->value = json_encode($request->only('title','sub_title')); $setting->save(); cache()->flush();
return redirect()->back()->with('success','Services Theme successfully updated'); } public function fees(Request $request){ if (env("APP_DEMO")){ return redirect()->back()->withErrors(['msg' => trans('admin.app_demo_message')]); }
$data = ['name' => 'fees']; $setting = auth()->user()->settings()->firstOrNew($data); if($request->service) { foreach ($request->service as $key => $service) { $fees_data[] = [ 'service' => $service, 'type_of_instrument' => isset($request->type_of_instrument[$key])?$request->type_of_instrument[$key]:'', 'uhn_rate' => isset($request->uhn_rate[$key])?$request->uhn_rate[$key]:'', 'ea_rate' => isset($request->ea_rate[$key])?$request->ea_rate[$key]:'', ]; } $request['fees_data'] = $fees_data; }
$data = ['name' => 'fees']; $setting = auth()->user()->settings()->firstOrNew($data); $setting->value = json_encode($request->only('title','sub_title','fees_data')); $setting->save();
cache()->flush(); return redirect()->back()->with('success','Fees Theme successfully update'); } public function courses(Request $request){ if (env("APP_DEMO")){ return redirect()->back()->withErrors(['msg' => trans('admin.app_demo_message')]); } if($request->hasFile('image')){ if (isset($request->pre_image) && !empty($request->pre_image)) { $oldImagePath = public_path('/uploads') . '/' . $request->pre_image; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file=$request->file('image'); $imageone=time().'imo'.'.'.$file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $imageone); $request['imageone']=$imageone; }else{ $request['imageone']=$request->pre_image; } if($request->hasFile('image_two')){ if (isset($request->pre_image_two) && !empty($request->pre_image_two)) { $oldImagePath = public_path('/uploads') . '/' . $request->pre_image_two; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file=$request->file('image_two'); $image_two=time().'imt'.'.'.$file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $image_two); $request['imagetwo']=$image_two; } else{ $request['imagetwo']=$request->pre_image_two; } if($request->hasFile('image_three')){ if (isset($request->pre_image_three) && !empty($request->pre_image_three)) { $oldImagePath = public_path('/uploads') . '/' .$request->pre_image_three; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file=$request->file('image_three'); $image_three=time().'imth'.'.'.$file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $image_three); $request['imagethree']=$image_three; } else{ $request['imagethree']=$request->pre_image_three; } if($request->hasFile('image_four')){ if (isset($request->pre_image_four) && !empty($request->pre_image_four)) { $oldImagePath = public_path('/uploads') . '/' . $request->pre_image_four; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file=$request->file('image_four'); $image_four=time().'imfo'.'.'.$file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $image_four); $request['imagefour']=$image_four; } else{ $request['imagefour']=$request->pre_image_four; } $data = ['name' => 'courses']; $setting = auth()->user()->settings()->firstOrNew($data); $setting->value = json_encode($request->only('title','title_two','title_three','title_four','description','description_two','description_three','description_four', 'imageone','imagetwo','imagethree','imagefour')); $setting->save();
cache()->flush(); return redirect()->back()->with('success','Courses Theme successfully update'); } public function home_section_store(Request $request){
if (env("APP_DEMO")){ return redirect()->back()->withErrors(['msg' => trans('admin.app_demo_message')]); } if($request->hasFile('image')){ if (isset($request->pre_image) && !empty($request->pre_image)) { $oldImagePath = public_path('/uploads') . '/' . $request->pre_image; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file=$request->file('image'); $imageone=time().'imo'.'.'.$file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $imageone); $request['imageone']=$imageone; }else{ $request['imageone']=$request->pre_image; } $data = ['name' => 'home_section']; $setting = auth()->user()->settings()->firstOrNew($data); $setting->value = json_encode($request->only('title','imageone','description','welcome_text','user_name')); $setting->save();
cache()->flush(); return redirect()->back()->with('success','Home Section Theme successfully update'); } public function feadback_index(){ return view('admin.feadback.index'); } public function contact_list(){ return view('admin.contact.list'); } public function feadback_store(Request $request) { // dd($request->all()); $feadbacks = [];
$feadbacks = []; if($request->user_names) { foreach ($request->user_names as $key => $name) {
$imagePath = ''; if (isset($request->pre_image[$key]) && $request->pre_image[$key]) { $imagePath = $request->pre_image[$key]; } else if (isset($request->image[$key]) && $request->image[$key]) { if (isset($request->pre_image[$key]) && !empty($request->pre_image[$key])) { $oldImagePath = public_path('/uploads') . '/' . $request->pre_image[$key]; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file = $request->file('image')[$key]; $imageName = time() . $key . '.' . $file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $imageName); $imagePath = $imageName; }
$feadbacks[] = [ 'user_name' => $name, 'designation' => isset($request->designation[$key])?$request->designation[$key]:'', 'user_review_text' => isset($request->user_review_text[$key])?$request->user_review_text[$key]:'', 'image' => $imagePath, ]; }
} $request['feadbacks'] = $feadbacks; $data = ['name' => 'feadback_section']; $setting = auth()->user()->settings()->firstOrNew($data); $setting->value = json_encode($request->only('feadback_title','feadback_sub_title','feadback_short_description','feadbacks')); $setting->save();
cache()->flush(); return redirect()->route('admin.theme.feadback.index')->with('success', 'Successfully saved data'); } public function contact_us_index(){ return view('admin.home_contact_us.index'); }
public function contact_us_store(Request $request){
$home_contact_us_sections = json_decode(get_settings('home_contact_us')); $data = ['name' => 'home_contact_us']; $home_contact_us_sections = auth()->user()->settings()->firstOrNew($data);
if($request->facebook_link){ $facebook_link = $request->facebook_link; if (!str_starts_with($facebook_link, 'https://')) { $request['facebook_link'] = 'https://' . $facebook_link; } } if($request->twitter_link){ $twitter_link = $request->twitter_link; if (!str_starts_with($twitter_link, 'https://')) { $request['twitter_link'] = 'https://' . $twitter_link; } } if($request->instagram_link){ $instagram_link = $request->instagram_link; if (!str_starts_with($instagram_link, 'https://')) { $request['instagram_link'] = 'https://' . $instagram_link; } } if($request->linkedin_link){ $linkedin_link = $request->linkedin_link; if (!str_starts_with($linkedin_link, 'https://')) { $request['linkedin_link'] = 'https://' . $linkedin_link; } }
$home_contact_us_sections->value = json_encode($request->only('contact_us_title', 'contact_us_short_description', 'contact_us_address','contact_us_phone_number','facebook_link', 'twitter_link', 'instagram_link', 'linkedin_link','contact_us_email')); $home_contact_us_sections->save(); cache()->flush(); return redirect()->route('admin.theme.contact.index')->with('success', 'Successfully saved data'); } public function my_goal(){ return view('admin.my_goal.index'); } public function my_goalStore(Request $request){ if (env("APP_DEMO")){ return redirect()->back()->withErrors(['msg' => trans('admin.app_demo_message')]); } if($request->hasFile('section_img_one')){ if (isset($request->pre_image) && !empty($request->pre_image)) { $oldImagePath = public_path('/uploads') . '/' . $request->pre_image; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file=$request->file('section_img_one'); $imageone=time().'imo'.'.'.$file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $imageone); $request['imageone']=$imageone; }else{ $request['imageone']=$request->pre_image; } if($request->hasFile('section_img_two')){ if (isset($request->pre_image_two) && !empty($request->pre_image_two)) { $oldImagePath = public_path('/uploads') . '/' . $request->pre_image_two; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file=$request->file('section_img_two'); $image_two=time().'imt'.'.'.$file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $image_two); $request['imagetwo']=$image_two; } else{ $request['imagetwo']=$request->pre_image_two; } if($request->hasFile('section_img_three')){ if (isset($request->pre_image_three) && !empty($request->pre_image_three)) { $oldImagePath = public_path('/uploads') . '/' .$request->pre_image_three; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file=$request->file('section_img_three'); $image_three=time().'imth'.'.'.$file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $image_three); $request['imagethree']=$image_three; } else{ $request['imagethree']=$request->pre_image_three; } if($request->hasFile('section_img_four')){ if (isset($request->pre_image_four) && !empty($request->pre_image_four)) { $oldImagePath = public_path('/uploads') . '/' . $request->pre_image_four; if (file_exists($oldImagePath)) { unlink($oldImagePath); } } $file=$request->file('section_img_four'); $image_four=time().'imfo'.'.'.$file->getClientOriginalExtension(); $file->move(public_path('/uploads'), $image_four); $request['imagefour']=$image_four; } else{ $request['imagefour']=$request->pre_image_four; } $data = ['name' => 'my_goal']; $setting = auth()->user()->settings()->firstOrNew($data); $setting->value = json_encode($request->only('title','description','section_title_one','section_title_two','section_title_three','section_title_four','section_description_one','section_description_two','section_description_three','section_description_four', 'imageone','imagetwo','imagethree','imagefour')); $setting->save();
cache()->flush(); return redirect()->back()->with('success','My Goal successfully update'); }
public function management(){ return view('admin.management.index'); } public function management_store(Request $request){ if (env("APP_DEMO")){ return redirect()->back()->withErrors(['msg' => trans('admin.app_demo_message')]); } $data = ['name' => 'management_section']; $setting = auth()->user()->settings()->firstOrNew($data); $setting->value = json_encode($request->only('title','sub_title','description','counter_one_title', 'counter_two_title','counter_three_title','counter_one_number','counter_two_number','counter_three_number')); $setting->save(); cache()->flush(); return redirect()->back()->with('success','Management Section successfully update'); } }
|