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


PHP Setting::findOrFail方法代码示例

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


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

示例1: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     // bind article
     $router->model('article', 'App\\Article');
     $router->bind('admin.article', function ($id) {
         return \App\Article::findOrFail($id);
     });
     // bind category
     $router->model('category', 'App\\Category');
     $router->bind('admin.category', function ($id) {
         return \App\Category::findOrFail($id);
     });
     // bind language
     $router->model('language', 'App\\Language');
     $router->bind('admin.language', function ($id) {
         return \App\Language::findOrFail($id);
     });
     // bind language
     $router->model('page', 'App\\Page');
     $router->bind('admin.page', function ($id) {
         return \App\Page::findOrFail($id);
     });
     // bind setting
     $router->model('setting', 'App\\Setting');
     $router->bind('admin.setting', function ($id) {
         return \App\Setting::findOrFail($id);
     });
     // bind user
     $router->model('user', 'App\\User');
     $router->bind('admin.user', function ($id) {
         return \App\User::findOrFail($id);
     });
     parent::boot($router);
 }
开发者ID:abada,项目名称:laravel-5-simple-cms,代码行数:40,代码来源:RouteServiceProvider.php

示例2: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //
     $setting = Setting::findOrFail(1);
     $nhservers = Nhserver::all();
     return view('setting.index', array('setting' => $setting, 'nhservers' => $nhservers));
 }
开发者ID:leloulight,项目名称:work-order,代码行数:12,代码来源:SettingController.php

示例3: update

 public function update(Requests\SettingRequest $request, $id)
 {
     $setting = Setting::findOrFail($id);
     //$setting->fill(\Request::all());
     //return ['ok'=>$setting->save()];
     return ['ok' => $setting->update($request->all())];
 }
开发者ID:tianyirenjian,项目名称:laravel-blog,代码行数:7,代码来源:SettingController.php

示例4: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(SettingRequest $request, $id)
 {
     $setting = Setting::findOrFail($id);
     $setting->update($request->all());
     session()->flash('flash_message', 'Se han actualizado los datos del Blog');
     return redirect('admin/settings?tab=blog');
 }
开发者ID:realnerdo,项目名称:blog,代码行数:14,代码来源:SettingsController.php

示例5: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //
     $setting = Setting::findOrFail(1);
     $nhservers = Nhserver::all();
     $devices = EngineerDevice::groupBy("device_sn")->count('device_sn');
     $locations = EngineerDevice::groupBy('location_name')->count('location_name');
     $engineers = EngineerDevice::groupBy('engineer_name')->count('engineer_name');
     return view('setting.index', array('setting' => $setting, 'nhservers' => $nhservers, 'devices' => $devices, 'locations' => $locations, 'engineers' => $engineers));
 }
开发者ID:vilison,项目名称:work-order,代码行数:15,代码来源:SettingController.php

示例6: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $this->validate($request, ['company_name' => 'required', 'company_name_kh' => 'required', 'company_name_ch' => 'required', 'company_logo' => 'required', 'copyright' => 'required', 'copyright_kh' => 'required', 'copyright_ch' => 'required', 'company_information' => 'required', 'company_information_ch' => 'required', 'company_information_kh' => 'required', 'meta_title' => 'required', 'meta_content' => 'required', 'meta_description' => 'required', 'meta_keyword' => 'required', 'status' => 'required|numeric']);
     $setting = Setting::findOrFail($id);
     $setting->updatedBy()->associate(Auth::user());
     /*$setting->thumb_image = $request->input('image');
       $setting->thumb_image = str_replace('source','thumbs',$setting->thumb_image);*/
     $setting->update($request->all());
     Session::flash('flash_message', 'Setting successfully updated!');
     return redirect()->back();
 }
开发者ID:TEACHER-KEAK,项目名称:GAD,代码行数:18,代码来源:SettingController.php

示例7: 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

示例8: getIndex

 public function getIndex()
 {
     $Set = Setting::findOrFail(1);
     return view('admin.pengaturan.index', ['Set' => $Set]);
 }
开发者ID:MediaSaktiTeam,项目名称:MS_kelautan,代码行数:5,代码来源:SettingController.php


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