本文整理汇总了PHP中app\models\Setting::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Setting::where方法的具体用法?PHP Setting::where怎么用?PHP Setting::where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Setting
的用法示例。
在下文中一共展示了Setting::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: remove
public static function remove($property)
{
$set = Setting::where('property', '=', $prop)->get()->first();
if ($set) {
$set->delete();
}
return $set;
}
示例2: getFeaturedAttribute
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;
}
示例3: save
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');
}
示例4: edit
/**
* 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);
}
示例5: update
/**
* 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');
}
示例6: update
/**
* 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');
}
}
示例7: update
/**
* 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');
}
}
示例8: getGridSize
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);
}
示例9: title
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);
}
示例10: deleteFeatured
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();
}
示例11: login
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'));
}
示例12: login
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'));
}
示例13: preference
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'));
}
示例14: viewSubject
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);
}
示例15: deleteFeatured
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();
}