本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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');
}
示例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);
});
}
示例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"));
}
示例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');
}
示例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';
}
}
示例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]);
}
}
示例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();
}
}
示例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);
}
示例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;
}
示例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]);
}
示例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);
}
示例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);
}