本文整理汇总了PHP中app\Setting::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Setting::find方法的具体用法?PHP Setting::find怎么用?PHP Setting::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Setting
的用法示例。
在下文中一共展示了Setting::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postUpdate
public function postUpdate($id)
{
$settingupdate = Request::all();
$setting = Setting::find($id);
$setting->update($settingupdate);
return redirect('admin/settings/')->with('flash_message', 'Settings Save');
}
示例2: store
public function store(Request $request)
{
foreach (Input::except('_token') as $id => $value) {
$setting = Setting::find($id);
$setting->value = $value;
$setting->save();
}
return redirect()->route("settings.all")->with('setting-saved', 'Successful saved!');
}
示例3: update
public function update(Request $request)
{
$settings = $request->except('_method', '_token');
foreach ($settings as $key => $value) {
$set = Setting::find($key);
$set->fill(['value' => $value])->save();
}
return redirect('/setting')->with('success', 'Sukses memperbarui pengaturan');
}
示例4: update
public function update($data)
{
$setting = null;
if (isset($data['id'])) {
$setting = Setting::find($data['id']);
$setting->update($data);
}
return $setting;
}
示例5: store
public function store(SettingRequest $request)
{
//remove from cache old data to update global website settings
Cache::forget('settings');
$settings = Setting::find(1);
//update database using json format
$settings->data = ['website_title' => $request->get('website_title'), 'admin_title' => $request->get('admin_title'), 'website_description' => $request->get('website_description'), 'admin_email' => $request->get('admin_email'), 'code_header' => $request->get('code_header'), 'code_footer' => $request->get('code_footer')];
$settings->update();
flash('Settings updated with success');
return redirect()->back();
}
示例6: ajax_variable
public function ajax_variable()
{
$data = Request::all();
$s = Setting::find($data['pk']);
// change name and value variable
if ($data['name'] == 'name') {
$s->name = $data['value'];
} elseif ($data['name'] == 'value') {
$s->value = $data['value'];
} else {
$s->lang_code = $data['lang_code'];
}
$s->save();
}
示例7: getRefresh
public function getRefresh(Request $req)
{
$Set1 = Setting::find(1);
$Set2 = Setting::find(2);
$Set1->sitename = $Set2->sitename;
$Set1->description = $Set2->description;
$Set1->email = $Set2->email;
$Set1->tag = $Set2->tag;
$Set1->fb = $Set2->fb;
$Set1->twitter = $Set2->twitter;
$Set1->gambar_utama = $Set2->gambar_utama;
$Set1->save();
$req->session()->flash('success', 'Berhasil mengembalikan pengaturan');
return redirect(route('setting'));
}
示例8: __construct
public function __construct()
{
View::share('pros', Product::take(8)->Where('status', 1)->orderBy('created_at', 'DESC')->get());
View::share('customs', Product::take(8)->Where('type', 0)->orderBy('created_at', 'DESC')->get());
View::share('products', Product::take(8)->Where('status', 1)->orderBy('created_at', 'DESC')->get());
View::share('cus', Product::take(8)->Where('status', 1)->orderBy('created_at', 'ASC')->get());
View::share('categories', Category::all());
View::share('cart_content', Cart::content());
View::share('count', Cart::count());
View::share('total', Cart::total());
View::share('set', Setting::find(1));
View::share('tos', Cart::tos());
View::share('transactions', Transaction::orderBy('created_at', 'desc')->paginate(10));
View::share('settings', Setting::find(1));
View::share('caty', Category::take(5)->orderBy('created_at', 'DESC')->get());
View::share('payments', Payment::Where('status', 1)->get());
View::share('customers', Customer::all());
View::share('orders', Order::all());
View::share('cat', Category::all());
View::share('db', Product::take(6)->Where('status', 1)->orderBy('created_at', 'ASC')->get());
}
示例9: store
public function store(Request $request)
{
$this->validate($request, ['app_name' => 'required|max:100']);
\DB::beginTransaction();
try {
$settings = Setting::find(1);
if (!empty($settings)) {
$settings->app_name = $request->app_name;
$settings->update();
} else {
$settings = new Setting();
$settings->app_name = $request->app_name;
$settings->save();
}
\DB::commit();
Session::flash('flash_message', 'Settings successfully updated!');
return redirect()->back();
} catch (Exception $e) {
DB::rollBack();
return redirect()->back();
}
}
示例10: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$settings = Setting::find(1);
$settings->uploader_email = $request->uploader_email;
$settings->enable_ig_edit = $request->has('enable_ig_edit') ? 1 : 0;
$settings->validate_posting_mkl = $request->has('validate_posting_mkl') ? 1 : 0;
$settings->validate_printing_mkl = $request->has('validate_printing_mkl') ? 1 : 0;
$settings->validate_posting_ass = $request->has('validate_posting_ass') ? 1 : 0;
$settings->validate_printing_ass = $request->has('validate_printing_ass') ? 1 : 0;
$settings->validate_reposting_mkl = $request->has('validate_reposting_mkl') ? 1 : 0;
$settings->validate_reposting_ass = $request->has('validate_reposting_ass') ? 1 : 0;
$settings->device_password = $request->device_password;
$settings->update();
$hash = UpdateHash::find(1);
if (empty($hash)) {
UpdateHash::create(['hash' => \Hash::make(date('Y-m-d H:i:s'))]);
} else {
$hash->hash = md5(date('Y-m-d H:i:s'));
$hash->update();
}
Session::flash('flash_message', 'Settings successfully updated.');
Session::flash('flash_class', 'alert-success');
return redirect()->route("settings.index");
}
示例11: contact
public function contact()
{
$data['setting'] = Setting::find(1);
return view('front.contact.index', $data);
}
示例12: saveSettings
public function saveSettings(Request $request)
{
$settings = Setting::find(1);
$settings->voteInterval = $request->input('voteInterval');
$settings->save();
return redirect('admin/settings')->with('status', 'Settings updated!');
}
示例13: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
//
$setting = Setting::find($id);
$setting->delete();
return redirect()->route('setting.index');
}
示例14: addVote
public function addVote(Request $request)
{
$this->validate($request, ['g-recaptcha-response' => 'required|recaptcha']);
$id = $request->input('server_id');
$settings = Setting::find(1);
$interval = $settings->voteInterval;
$ip = getHostByName(php_uname('n'));
//Check if user alredy voted in 24h
$vote = Vote::where('ip', $ip)->first();
if ($vote != null) {
if ($vote->updated_at->addHours($interval) > Carbon::now()) {
//already voted
return redirect('server/' . $id)->withErrors('You have already voted. Now you can vote after ' . $interval . ' hours from your voting time');
}
}
//Deletes old record
Vote::where('ip', $ip)->delete();
$server = serverModel::where('id', $id)->first();
$votes = $server->votes;
$server->votes = $votes + 1;
$server->save();
$vote = new Vote();
$vote->ip = $ip;
$vote->save();
return redirect('server/' . $id)->with('status', 'You have successfully voted!');
}
示例15: utime
public function utime(Request $request)
{
//
$id = 1;
$setting = Setting::find($id);
$setting->refresh_interval = $request->refresh_interval;
if (intval($setting->refresh_interval) < 1) {
$setting->refresh_interval = 1;
}
$setting->warn_timeout = $request->warn_timeout;
$setting->save();
echo 1;
}