本文整理汇总了PHP中Setting::findOrFail方法的典型用法代码示例。如果您正苦于以下问题:PHP Setting::findOrFail方法的具体用法?PHP Setting::findOrFail怎么用?PHP Setting::findOrFail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Setting
的用法示例。
在下文中一共展示了Setting::findOrFail方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
public function update($id)
{
$setting = Setting::findOrFail($id);
$validator = Validator::make($data = Input::all(), Setting::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
unset($data['logo']);
// Logo Image Upload
if (Input::hasFile('logo')) {
$path = public_path() . "/assets/admin/layout/img/";
File::makeDirectory($path, $mode = 0777, true, true);
$image = Input::file('logo');
$extension = $image->getClientOriginalExtension();
$filename = "logo.{$extension}";
$filename_big = "logo-big.{$extension}";
Image::make($image->getRealPath())->save($path . $filename);
Image::make($image->getRealPath())->save($path . $filename_big);
$data['logo'] = $filename;
}
$currencyArray = explode(':', $data['currency']);
$data['currency'] = $currencyArray[1];
$data['currency_icon'] = $currencyArray[0];
$setting->update($data);
Session::flash('success', '<strong>Success! </strong>Updated Successfully');
return Redirect::route('admin.settings.edit', 'setting');
}
示例2: ajax_update_notification
public function ajax_update_notification()
{
$setting = Setting::findOrFail(Input::get('id'));
$input[Input::get('type')] = Input::get('value');
$setting->update($input);
$output['success'] = 'success';
return Response::json($output, 200);
}
示例3: update
/**
* Update the specified setting in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
$setting = Setting::findOrFail($id);
$validator = Validator::make($data = Input::all(), Setting::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
$setting->update($data);
return Redirect::route('admin.settings.index')->withTitle('Settings')->with("successMessage", "Pengaturan Berhasil diubah");
}
示例4: postIndex
public function postIndex()
{
//dd(Input::all());
$user = Auth::user()->id;
$setting = Setting::findOrFail(Input::get('id'));
$validator = Validator::make($data = Input::all(), Setting::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
$settings = array('language' => Input::get('language'), 'currency_id' => Input::get('country_id'));
$item = Setting::where('id', '=', Input::get('id'))->update($settings);
return Redirect::to('settings')->with('success', Lang::get('settings.message.success.update'));
}
示例5: update
/**
* Update the specified setting in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
$id = Input::get('id');
$setting = Setting::findOrFail($id);
$validator = Validator::make($data = Input::all(), Setting::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
if (Input::has('modeSetting')) {
$setting->update($data);
}
$message = "更新しました。";
return Redirect::route('settings.index')->with('message', $message);
}
示例6: update
/**
* Update the specified resource in storage.
* PUT /settings/{id}
*
* @param int $id
* @return Response
*/
public function update($id)
{
$validator = Validator::make($data = Input::all(), ['color' => 'required']);
$setting = Setting::findOrFail($id);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
if (Input::get('remove_logo') != NULL) {
$data['logo'] = '';
} elseif (Input::hasFile('logo')) {
$file = Input::file('logo');
$filename = $file->getClientOriginalName();
$destination = $this->settings_path;
if (!$this->filesystem->exists($destination)) {
$this->filesystem->mkdir($destination);
}
try {
Input::file('logo')->move($destination, $filename);
} catch (Exception $e) {
dd("Error uploading file " . $e->getMessage());
}
$data['logo'] = $filename;
} else {
$data['logo'] = $setting->logo;
}
$setting->color = $data['color'];
$setting->logo = $data['logo'];
$setting->name = $data['name'];
$setting->maintenance_mode = isset($data['maintenance_mode']) ? 1 : 0;
$this->setRobot($setting->maintenance_mode);
$setting->facebook = isset($data['facebook']) ? $data['facebook'] : '';
$setting->linkedin = isset($data['linkedin']) ? $data['linkedin'] : '';
$setting->twitter = isset($data['twitter']) ? $data['twitter'] : '';
$setting->pinterest = isset($data['pinterest']) ? $data['pinterest'] : '';
$setting->gplus = isset($data['gplus']) ? $data['gplus'] : '';
$setting->footer = isset($data['footer']) ? $data['footer'] : '';
$setting->save();
return Redirect::to("/settings/" . $setting->id . "/edit")->withMessage("Settings Updated");
}
示例7: update
/**
* Update the specified setting in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
$setting = Setting::findOrFail($id);
$validator = Validator::make($data = Input::all(), Setting::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
$setting->update($data);
return Redirect::route('settings.index');
}
示例8: fetch
/**
* fetch() Fetch and return a current database value
* @var string, Setting name to fetch the value of
*
* @return string, The current setting value
* */
public static function fetch($name)
{
$setting = Setting::findOrFail($name);
$value = $setting->value;
return $value;
}