public static function remove($property) { $set = Setting::where('property', '=', $prop)->get()->first(); if ($set) { $set->delete(); } return $set; }
public function getFeaturedAttribute() { $featuredSetting = Setting::where('meta_key', '=', 'featured-doc')->first(); if ($featuredSetting) { $docIds = explode(',', $featuredSetting->meta_value); return in_array($this->id, $docIds); } return false; }
public function save() { $setting = Setting::where('lang', getLang())->first() ?: new Setting(); $formData = Input::all(); unset($formData['_token']); $json = json_encode($formData); $setting->fill(array('settings' => $json, 'lang' => getLang()))->save(); Flash::message('Settings was successfully updated'); return Redirect::route('admin.settings'); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $data['parray'] = array('circuit_stewards', 'treasurer', 'superintendent', 'circuit_secretary', 'site_editors', 'supervisor_of_studies', 'local_preachers_secretary'); $data['setting'] = Setting::where('setting_field', '=', $id)->firstOrFail(); if (in_array($data['setting']->setting_field, $data['parray'])) { $data['chosenind'] = explode(',', $data['setting']->setting_value); $data['individuals'] = Individual::orderBy('surname')->orderBy('firstname')->get(); } return View::make('settings.edit', $data); }
/** * Update settings. * * @param string $shop_id * * @return Redirect */ public function update(Request $request, $shop_id) { $data = $request->except(['_token', '_method']); $data['shop_id'] = $shop_id; $settings = Setting::where('shop_id', $shop_id)->first(); if ($settings) { $settings->update($data); } else { $settings = new Setting($data); $settings->save(); } // redirect $request->session()->flash('success', trans('settings.settings') . ' ' . trans('crud.updated')); return redirect('admin/settings'); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id = 1) { $setting = Setting::find($id); $cekinput = Input::file('setheader'); // Header Website if (!empty($cekinput)) { $oldfile = Setting::where('id_setting', $id)->first(); File::delete('upload/logo/' . $oldfile->bg_header); $thefile = Input::file('setheader'); $lokasi_simpan = 'upload/logo'; $filename = str_random(30) . '.' . $thefile->getClientOriginalExtension(); $upload_gambar = Input::file('setheader')->move($lokasi_simpan, $filename); $setting->bg_header = $filename; } if ($setting->save()) { return redirect()->back()->with('alert', 'Data berhasil di simpan'); } }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id = 1) { // $setting = Setting::find($id); $cekinputlogo = Input::file('file'); $cekinputicon = Input::file('favicon'); // Logo Website if (!empty($cekinputlogo)) { $oldfile = Setting::where('id_setting', $id)->first(); File::delete('upload/logo/' . $oldfile->logo); $thefile = Input::file('file'); $lokasi_simpan = 'upload/logo'; $filename = str_random(30) . '.' . $thefile->getClientOriginalExtension(); $upload_gambar = Input::file('file')->move($lokasi_simpan, $filename); $setting->logo = $filename; } // Favicon Website if (!empty($cekinputicon)) { $oldfile = Setting::where('id_setting', $id)->first(); File::delete('upload/logo/' . $oldfile->favicon); $thefile = Input::file('favicon'); $lokasi_simpan = 'upload/logo'; $filename = str_random(30) . '.' . $thefile->getClientOriginalExtension(); $upload_gambar = Input::file('favicon')->move($lokasi_simpan, $filename); $setting->favicon = $filename; } $setting->title_web = Input::get('title_web'); $setting->desc_web = Input::get('desc_web'); $setting->key_web = Input::get('key_web'); $setting->peta_latitude = Input::get('peta_latitude'); $setting->peta_longitude = Input::get('peta_longitude'); $setting->facebook = Input::get('facebook'); $setting->twitter = Input::get('twitter'); $setting->gplus = Input::get('gplus'); $setting->alamat = Input::get('alamat'); $setting->no_telp = Input::get('no_telp'); $setting->no_fax = Input::get('no_fax'); $setting->email = Input::get('email'); if ($setting->save()) { return redirect()->back()->with('alert', 'Data berhasil di simpan'); } }
public function getGridSize() { // Atur Grid Menu $h = Setting::where('name', 'grid_height')->get(); if (count($h) > 0) { $h = $h->first()->value; } else { $h = 3; } $w = Setting::where('name', 'grid_width')->get(); if (count($w) > 0) { $w = $w->first()->value; } else { $w = 3; } $result = new \StdClass(); $result->h = $h; $result->w = $w; return response()->json($result); }
public function title() { $name = $request->input('name'); $value = $request->input('value'); $result = Setting::where('name', $name)->get(); $trigger = count($result) > 0 ? true : false; if ($trigger) { $result = $result->first(); $result->value = $value; $result->save(); } else { $result = new Setting(); $result->name = $name; $result->value = $value; $result->save(); } $results = new \StdClass(); $results->info = 'title preference save'; $results->status = 1; $results->message = 'Title has been successfuly updated'; $results->result = $result; return response()->json($results); }
public function deleteFeatured($docId) { if (!Auth::user()->hasRole('Admin')) { return Response::json($this->growlMessage('You are not authorized to change the Featured Document.', 'error'), 403); } // firstOrNew() is not working for some reason, so we do it manually. $featuredSetting = Setting::where(array('meta_key' => 'featured-doc'))->first(); if (!$featuredSetting) { $featuredSetting = new Setting(); $featuredSetting->meta_key = 'featured-doc'; } $docs = explode(',', $featuredSetting->meta_value); if (in_array($docId, $docs)) { $docs = array_diff($docs, array($docId)); } $featuredSetting->meta_value = join(',', $this->cleanDocs($docs)); $featuredSetting->save(); return $this->getFeaturedShort(); }
public function login() { $result1 = DB::table('parent_menu')->get(); $datanyah = DB::table('parent_frontpage')->get(); $title = Setting::where('name', 'title')->get(); if (count($title) > 0) { $title = $title->first()->value; } else { $title = 'Login Page'; } $bg = Setting::where('name', 'background')->get(); if (count($bg) > 0) { $bg = asset('/uploads/background/') . '/' . $bg->first()->value; } else { $bg = 'assets/img/bg.jpg'; } $logo = Setting::where('name', 'logo')->get(); if (count($logo) > 0) { $logo = asset('/uploads/logo/') . '/' . $logo->first()->value; $logo = preg_replace('/\\s+/', '', $logo); } else { $logo = '#'; } $siteTitle = Setting::where('name', 'title')->get(); if (count($siteTitle) > 0) { $bah = $siteTitle->first()->value; } else { $bah = 'Website'; } $footer = Setting::where('name', 'footer')->get(); if (count($footer) > 0) { $footer = $footer->first()->value; } else { $footer = '(c) 2015, Ordent, All Right Reserved.'; } return view('frontend.login', compact('result1', 'title', 'datanyah', 'bg', 'bah', 'footer', 'logo')); }
public function login() { $result1 = DB::table('parent_menu')->get(); $datanyah = DB::table('parent_frontpage')->get(); $siteTitle = Setting::where('name', 'title')->get(); if (count($siteTitle) > 0) { $bah = $siteTitle->first()->value; } else { $bah = 'Website'; } return view('frontend.login', compact('result1', 'bah', 'datanyah')); }
public function preference() { $css = $this->CSS('style-upload'); $jH = $this->jS('image'); $title = 'Preference'; $result1 = DB::select('SELECT child_menu.name as "ch_name" FROM parent_menu INNER JOIN child_menu ON child_menu.parent_id = parent_menu.id'); $a = 1; $result2 = count(Setting::where('name', 'title')->get()) > 0 ? Setting::where('name', 'title')->get()->first()->value : ""; $result3 = count(Setting::where('name', 'footer')->get()) > 0 ? Setting::where('name', 'footer')->get()->first()->value : ""; $filesLogo = File::files(public_path() . '/' . \App\Models\Setting::LOGO_UPLOAD_PATH); $filesBg = File::files(public_path() . '/' . \App\Models\Setting::BG_UPLOAD_PATH); $footer = Setting::where('name', 'footer')->get(); if (count($footer) > 0) { $footer = $footer->first()->value; } else { $footer = '(c) Ordent ' . date('Y'); } return view('backend.preference', compact('css', 'jH', 'title', 'result2', 'result3', 'filesLogo', 'filesBg', 'footer')); }
public function viewSubject($id, Subject $subject, Setting $setting, Request $request) { $page_data = array('subject' => $subject->find($id), 'subject_settings' => $setting->where('subject_id', '=', $id)->first()); $request->session()->flush(); return view('update_subject', $page_data); }
public function deleteFeatured($docId) { if (!Auth::user()->hasRole('Admin')) { return Response::json($this->growlMessage('You are not authorized to change the Featured Document.', 'error'), 403); } try { $featuredSetting = Setting::where('meta_key', '=', 'featured-doc')->first(); $docs = explode(',', $featuredSetting->meta_value); if (in_array($docId, $docs)) { $docs = array_diff($docs, array($docId)); } $featuredSetting->meta_value = join(',', $docs); $featuredSetting->save(); } catch (Exception $e) { return Response::json($this->growlMessage('There was an error updating the Featured Document', 'error'), 500); } return $this->getFeatured(); }
public function frontendShow($id) { $result = News::find($id); if (is_null($result)) { $result = News::where('slug', $id)->get()->first(); } $title = $result->title; $result1 = DB::table('parent_menu')->get(); $siteTitle = Setting::where('name', 'title')->get(); if (count($siteTitle) > 0) { $bah = $siteTitle->first()->value; } else { $bah = 'Website'; } $footer = Setting::where('name', 'footer')->get(); if (count($footer) > 0) { $footer = $footer->first()->value; } else { $footer = '(c) 2015, Ordent, All Right Reserved.'; } return view('frontend.news-show', compact('result', 'title', 'result1', 'footer')); }
public function preference() { $css = $this->CSS('style-upload'); $jH = $this->jS('image'); $title = 'Preference'; $a = 1; $result2 = count(Setting::where('name', 'title')->get()) > 0 ? Setting::where('name', 'title')->get()->first()->value : ""; $result3 = count(Setting::where('name', 'footer')->get()) > 0 ? Setting::where('name', 'footer')->get()->first()->value : ""; $filesLogo = File::files(public_path() . '/' . \App\Models\Setting::LOGO_UPLOAD_PATH); $filesBg = File::files(public_path() . '/' . \App\Models\Setting::BG_UPLOAD_PATH); $footer = Setting::where('name', 'footer')->get(); if (count($footer) > 0) { $footer = $footer->first()->value; } else { $footer = '(c) Ordent ' . date('Y'); } $sB = $this->getPermission('1'); $sBa = $this->getDefault(); $sBe = $this->getDefault(); $sBd = $this->getDefault(); return view('backend.preference', compact('css', 'jH', 'title', 'result2', 'result3', 'filesLogo', 'filesBg', 'footer', 'sB')); }
public static function getSetting($key) { $setting = Setting::where('setting_field', '=', $key)->first(); if (count($setting)) { return $setting->setting_value; } }