本文整理汇总了PHP中app\Setting类的典型用法代码示例。如果您正苦于以下问题:PHP Setting类的具体用法?PHP Setting怎么用?PHP Setting使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Setting类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: patchSettings
/**
* Update the settings in storage.
*
* @param Setting $setting
* @param SettingRequest $request
* @return Response
*/
public function patchSettings(Setting $setting, SettingRequest $request)
{
$data = $this->storeImage($request, 'logo');
$setting->fill($data);
$setting->save() == true ? Flash::success(trans('admin.update.success')) : Flash::error(trans('admin.update.fail'));
return redirect(route('admin.setting.index'));
}
示例2: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $load
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Setting $setting)
{
Cache::forget('settings');
$setting->updateSettings($request, ['site_title', 'site_tags', 'site_description', 'allow_registration', 'pagination_num']);
flash()->success(trans('all.entry_updated'));
return redirect(action('Admin\\SettingsController@index'));
}
示例3: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Setting $setting)
{
$this->validate($request, ['who_can_see_my_skills' => 'required|in:' . join(",", Setting::$options), 'who_can_see_who_i_am_following' => 'required|in:' . join(",", Setting::$options)]);
\ChromePhp::log($setting->getTable());
$this->authorize('owns', $setting);
$setting->who_can_see_my_skills = $request->who_can_see_my_skills;
$setting->who_can_see_who_i_am_following = $request->who_can_see_who_i_am_following;
$setting->save();
return "Settings updated.";
}
示例4: 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');
}
示例5: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(Request $request)
{
$v = Validator::make($request->all(), ['username' => 'required|unique:users|alpha_num', 'email' => 'required|unique:users|email', 'emailConfirmation' => 'required|same:email', 'password' => 'required', 'passwordConfirmation' => 'required|same:password', 'tos' => 'required']);
//recaptcha implementation
$recaptcha = new \ReCaptcha\ReCaptcha(Setting::getSetting('recaptchasecret'));
$resp = $recaptcha->verify($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']);
//dd($resp);
if ($v->fails() || $resp->isSuccess() == false) {
if ($resp->isSuccess() == false) {
$v->errors()->add('g-recaptcha', 'Би машин биш гэсэн чагтыг тэмдэглэнэ үү');
}
$errors = $v->errors();
$return['status'] = false;
$return['errors'] = $errors;
//return redirect('/user/register')->back()->withErrors($v->errors())->withInput($request->except('password'));
} else {
$user = new User();
$user->email = $request->input('email');
$user->password = Hash::make($request->input('password'));
$user->register_ip = $_SERVER['REMOTE_ADDR'];
$user->registered_with = 'local';
$user->public = 0;
$user->status = 1;
$user->role = 2;
$user->save();
$this->sendThankYouEmail($user);
Auth::login($user, true);
$return['status'] = true;
$return['url'] = url('/user/profile/' . $user->usr_id);
}
return $return;
}
示例6: 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');
}
示例7: boot
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
foreach (Setting::all() as $setting) {
$exp = explode("_", $setting->name);
config([$exp[0] . "." . $exp[1] => $setting->value]);
}
}
示例8: 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);
}
示例9: setting
/**
* Get setting
*
* @param $name
* @return mixed
*/
function setting($name)
{
$settings = Cache::rememberForever('settings', function () {
return Setting::select('name', 'value')->get();
});
return $settings->where('name', $name)->first();
}
示例10: show
public function show($id)
{
$lesson = Lesson::find($id);
$ratings = [];
if (!$lesson) {
return response('Leeson not found', 404);
}
if ($lesson->enabled) {
$length = 90;
//minute
$now = new Carbon();
if ($lesson->updated_at->diffInMinutes($now) > $length) {
$lesson->enabled = 0;
$lesson->save();
}
} else {
$ratings = Rating::withTrashed()->where('lesson_id', '=', $id)->get()->all();
}
$bookmarks = $lesson->bookmarks->sortBy('bookmarked_at');
foreach ($bookmarks as $bookmark) {
$bookmark->bookmarked_at = new Carbon($bookmark->bookmarked_at);
}
$settings = Setting::all();
return response()->view('lesson.show', ['lesson' => $lesson, 'ratings' => $ratings, 'bookmarks' => $bookmarks, 'settings' => $settings]);
}
示例11: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
Label::create(['name' => 'favorite']);
Label::create(['name' => 'trashed']);
Setting::insert([['name' => 'homeTagline', 'value' => 'Syntropy Cloud, Your Cloud Your Way'], ['name' => 'homeByline', 'value' => 'Register or Login now to upload, backup, manage and access your files on any device, from anywhere, free.'], ['name' => 'homeButtonText', 'value' => 'Register Now'], ['name' => 'homepage', 'value' => 'landing'], ['name' => 'blacklist', 'value' => 'exe, application/x-msdownload, x-dosexec'], ['name' => 'maxFileSize', 'value' => 20], ['name' => 'maxUserSpace', 'value' => 104857600], ['name' => 'enableRegistration', 'value' => 1], ['name' => 'siteName', 'value' => 'CryptOffice'], ['name' => 'enableHomeUpload', 'value' => 1], ['name' => 'maxSimultUploads', 'value' => 10], ['name' => 'enablePushState', 'value' => 0], ['name' => 'dateLocale', 'value' => 'en'], ['name' => 'pushStateRootUrl', 'value' => '/'], ['name' => 'disqusShortname', 'value' => 'cryptoffice'], ['name' => 'enablePayments', 'value' => 1]]);
}
示例12: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
//
\App\Setting::create(['name' => 'title', 'value' => 'Kibarer']);
\App\Setting::create(['name' => 'description', 'value' => 'Property Agency']);
\App\Setting::create(['name' => 'keyword', 'value' => 'kibarer, property agency, villa for sale, villa for rent, lands for sale, lands for rent']);
}
示例13: postUpdate
public function postUpdate($id)
{
$settingupdate = Request::all();
$setting = Setting::find($id);
$setting->update($settingupdate);
return redirect('admin/settings/')->with('flash_message', 'Settings Save');
}
示例14: balance_currency
/**
* Баланс пользователя в валюте пользователя
* @return float
*/
public function balance_currency()
{
$currency = $this->currency;
$course = Setting::get($currency . '_course', 1);
$balance = $this->balance / $course;
return $balance;
}
示例15: 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;
}