当前位置: 首页>>代码示例>>PHP>>正文


PHP Setting::where方法代码示例

本文整理汇总了PHP中app\Setting::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Setting::where方法的具体用法?PHP Setting::where怎么用?PHP Setting::where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Setting的用法示例。


在下文中一共展示了Setting::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setting

/**
* returns the value of $name setting as stored in DB // TODO refactor
*/
function setting($name, $default = false)
{
    $setting = \App\Setting::where('name', $name)->first();
    if ($setting) {
        return $setting->value;
    }
    return $default;
}
开发者ID:philippejadin,项目名称:Mobilizator,代码行数:11,代码来源:Functions.php

示例2: get

 /**
  * Static method to get a value from the settings table
  */
 public static function get($key, $default = false)
 {
     $setting = \App\Setting::where('name', $key)->first();
     if ($setting) {
         return $setting->value;
     }
     return $default;
 }
开发者ID:philippejadin,项目名称:Mobilizator,代码行数:11,代码来源:Setting.php

示例3: edit

 public function edit($locationID)
 {
     if (!Auth::check() || !Auth::user()->is_admin) {
         return response(view('errors.403', ['error' => $this->errorMessages['incorrect_permissions_news']]), 403);
     }
     $item = Location::find($locationID);
     // If no featured image, put in our default image
     $item->featured_image = $item->featured_image == '' ? Setting::where('name', 'default_profile_picture')->first()->setting : $item->featured_image;
     return view('locations.edit')->with('item', $item);
 }
开发者ID:TheJokersThief,项目名称:Eve,代码行数:10,代码来源:LocationController.php

示例4: update

 /**
  * Update the specified resource in storage.
  *
  * @return Response
  */
 public function update(GeneralRequest $request)
 {
     Setting::where('name', 'title')->update(['value' => $request->input('title')]);
     Setting::where('name', 'subtitle')->update(['value' => $request->input('subtitle')]);
     Setting::where('name', 'keywords')->update(['value' => $request->input('keywords')]);
     Setting::where('name', 'description')->update(['value' => $request->input('description')]);
     Setting::where('name', 'paginate_size')->update(['value' => $request->input('paginate_size')]);
     event(new SettingsChangedEvent());
     flash()->success(trans('flash_messages.settings_general_success'));
     return redirect('admin/settings/general');
 }
开发者ID:angelWendy,项目名称:streamlet,代码行数:16,代码来源:GeneralController.php

示例5: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     $data['user'] = $this->user;
     $data['event'] = $this->event;
     $data['ticket'] = $this->ticket;
     $data['company_logo'] = Setting::where('name', 'company_logo')->first()->setting;
     $data['company_name'] = Setting::where('name', 'company_name')->first()->setting;
     Mail::send('emails.ticket', $data, function ($message) use($data) {
         $message->from("no-reply@" . str_replace('http://', '', \URL::to('/')), $data['company_name']);
         $message->to($data['user']->email);
     });
 }
开发者ID:TheJokersThief,项目名称:Eve,代码行数:17,代码来源:SendEmail.php

示例6: update

 public function update(SettingsUpdateRequest $request)
 {
     $configs = $request->all();
     unset($configs["_method"]);
     unset($configs["_token"]);
     foreach ($configs as $name => $value) {
         $setting = Setting::where("name", $name)->first();
         $setting->value = $value;
         $setting->save();
     }
     return redirect()->route("admin.settings")->with("success", trans("realestateadmin::settings.updated"));
 }
开发者ID:labkod,项目名称:real-estate,代码行数:12,代码来源:SettingsController.php

示例7: saveSettings

 public function saveSettings(Request $request)
 {
     $input = $request->all();
     $notification = Setting::where('name', 'notification')->first();
     if (!count($notification)) {
         $notification = new Setting();
         $notification->name = 'notification';
     }
     $notification->value = $input['notification'];
     $notification->save();
     return redirect()->route('admin');
 }
开发者ID:andremiguelaa,项目名称:liga-quiz,代码行数:12,代码来源:AdminController.php

示例8: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $chart = Chart::find($id);
     if ($chart) {
         $data = new \StdClass();
         $logoUrl = Setting::where('meta_name', 'logoUrl')->first();
         $data->logoUrl = !empty($logoUrl) ? url('/') . '/' . $logoUrl->meta_value : '';
         return view('view.show', compact('chart', 'data'));
     } else {
         return 'No chart found to view';
     }
 }
开发者ID:HeidiWang123,项目名称:our-world-in-data-grapher,代码行数:18,代码来源:ViewController.php

示例9: updateForFile

 protected function updateForFile($request, $name)
 {
     if ($request->hasfile($name)) {
         $file = $request->file($name);
         if (!$file->isValid()) {
             throw new Exception(trans('strings.image_not_invalid'));
         }
         $filename = $name . '.' . $file->getClientOriginalExtension();
         $file->move(public_path('images/profile'), $filename);
         Setting::where('name', $name)->update(['value' => 'images/profile/' . $filename]);
     }
 }
开发者ID:angelWendy,项目名称:streamlet,代码行数:12,代码来源:ProfileController.php

示例10: addSetting

 public static function addSetting($setting, $value)
 {
     $settingobj = Setting::where('name', '=', $setting)->first();
     if ($settingobj) {
         return;
     }
     $settingobj = new Setting();
     if ($setting) {
         $settingobj->name = $setting;
         $settingobj->value = $value;
         $settingobj->save();
     }
 }
开发者ID:sordev,项目名称:bootup,代码行数:13,代码来源:Setting.php

示例11: index

 /**
  * Show the application dashboard.
  *
  * @return Response
  */
 public function index()
 {
     try {
         $isInstalled = Setting::where('name', 'is_installed')->firstOrFail();
     } catch (ModelNotFoundException $e) {
         $isInstalled = Setting::create(['name' => 'is_installed', 'setting' => 'no']);
     }
     if ($isInstalled->setting != 'yes') {
         return Redirect::route('install');
     }
     $data = ["event" => Event::first(), "upcomingEvents" => Event::take(3)->get(), "news" => News::take(6)->get(), "media" => Media::where('processed', true)->orderBy('id', 'DESC')->take(12)->get()];
     return view('home')->with($data);
 }
开发者ID:TheJokersThief,项目名称:Eve,代码行数:18,代码来源:HomeController.php

示例12: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $datasets = Dataset::all();
     $datasources = Datasource::all();
     $variables = Variable::all();
     $categories = DatasetCategory::all();
     $subcategories = DatasetSubcategory::all();
     $varTypes = VariableType::all();
     $sourceTemplate = Setting::where('meta_name', 'sourceTemplate')->first();
     $data = ['datasets' => $datasets, 'datasources' => $datasources, 'variables' => $variables, 'categories' => $categories, 'subcategories' => $subcategories, 'varTypes' => $varTypes, 'sourceTemplate' => $sourceTemplate];
     $response = view('import.index')->with('data', $data);
     return $response;
 }
开发者ID:mispy,项目名称:our-world-in-data-grapher,代码行数:18,代码来源:ImportController.php

示例13: index

 public function index()
 {
     if (!Auth::guest() && (Auth::user()->isAdmin() || Auth::user()->isActive())) {
         $notification = Setting::where('name', 'notification')->first();
         if (!count($notification)) {
             $notification = '';
         } else {
             $notification = $notification->value;
         }
     } else {
         $notification = '';
     }
     return view('home')->with(['notification' => $notification]);
 }
开发者ID:andremiguelaa,项目名称:liga-quiz,代码行数:14,代码来源:PublicController.php

示例14: recursive_copy

 /**
  * Recursively copy all the files from source folder to destination
  */
 public static function recursive_copy($src, $dst)
 {
     $dir = opendir($src);
     @mkdir($dst);
     while (false !== ($file = readdir($dir))) {
         if ($file != '.' && $file != '..') {
             if (is_dir($src . '/' . $file)) {
                 FileController::recursive_copy($src . '/' . $file, $dst . '/' . $file);
             } else {
                 copy($src . '/' . $file, $dst . '/' . $file);
             }
             @chmod($dst . '/' . $file, 0775);
             @chgrp($dst . '/' . $file, Setting::where('name', 'REGISTRATION_GROUP')->first()->setting);
         }
     }
     closedir($dir);
 }
开发者ID:UCCNetworkingSociety,项目名称:NetsocAdmin,代码行数:20,代码来源:FileController.php

示例15: doUpdateSettings

 public function doUpdateSettings(Request $request)
 {
     $ids = [];
     foreach ($request->except('_token') as $key => $field) {
         $tmp = explode("-", $key);
         $setting_id = $tmp[1];
         $ids[] = $setting_id;
         $setting = Setting::findOrFail($setting_id);
         $setting->updateValue($field);
     }
     if (Setting::where('type', 'checkbox')->count() > 0) {
         foreach (Setting::where('type', 'checkbox')->get() as $setting) {
             if (!in_array($setting->id, $ids)) {
                 $setting->updateValue(0);
             }
         }
     }
     return redirect()->back()->with('settings-saved', true);
 }
开发者ID:VoodooPrawn,项目名称:finest,代码行数:19,代码来源:SettingsController.php


注:本文中的app\Setting::where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。