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


PHP Setting::first方法代码示例

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


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

示例1: __construct

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function __construct()
 {
     $setting = Models\Setting::first();
     $this->data['menu'] = Models\Menu::with('child')->where('level', 0)->get();
     $this->data['berita'] = Models\Berita::orderBy('id_berita', 'desc')->limit(6)->get();
     $this->data['pengumuman'] = Models\Pengumuman::orderBy('tanggal', 'desc')->limit(10)->get();
     $this->data['agenda'] = Models\Agenda::orderBy('tgl_posting', 'desc')->limit(5)->get();
     $this->data['polling'] = Models\Polling::with('jawaban')->where('status', 'Y')->limit(1)->first();
     $this->data['title'] = $setting->title_web;
     $this->data['desc'] = $setting->desc_web;
     $this->data['key'] = $setting->key_web;
     $this->data['logo'] = $setting->logo;
     $this->data['header_img'] = $setting->bg_header;
     $this->data['icon'] = $setting->favicon;
     $this->data['facebook'] = $setting->facebook;
     $this->data['peta_latitude'] = $setting->peta_latitude;
     $this->data['peta_longitude'] = $setting->peta_longitude;
     $this->data['twitter'] = $setting->twitter;
     $this->data['gplus'] = $setting->gplus;
     $this->data['slider_home'] = Models\Berita::orderBy('tanggal', 'desc')->limit(5)->get();
     $this->data['galeri_home'] = Models\Foto::OrderBy('id_foto', 'desc')->paginate(9);
     $this->data['opini_home'] = Models\Berita::where('kategori_berita', 5)->orderBy('id_berita', 'desc')->limit(6)->get();
     $this->data['banner'] = Models\Banner::where('id', 1)->first();
     $this->data['link'] = Models\Link::orderBy('id', 'desc')->limit(5)->get();
     $this->data['publikasi'] = Models\Publikasi::orderBy('id', 'desc')->limit(3)->get();
     $this->data['setting'] = $setting;
 }
开发者ID:brutalcrozt,项目名称:SI-Sekolah-L5,代码行数:32,代码来源:FrontController.php

示例2: getSettings

 public static function getSettings()
 {
     static $static_cache = null;
     if (!$static_cache) {
         $static_cache = Setting::first();
     }
     return $static_cache;
 }
开发者ID:dmeltzer,项目名称:snipe-it,代码行数:8,代码来源:Setting.php

示例3: handle

 /**
  * Handle the command.
  *
  * @param  UpdateSettingCommand  $command
  * @return void
  */
 public function handle(UpdateSettingCommand $command)
 {
     $setting = Setting::first();
     $setting->salary = $command->salary;
     $setting->save = $command->save;
     if ($setting->save()) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:nq2916,项目名称:savings,代码行数:17,代码来源:UpdateSettingCommandHandler.php

示例4: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store()
 {
     //Check if exists
     $cost = Cost::exists($this->month, $this->year);
     if (!empty($cost)) {
         return $this->saveResponse(false);
     }
     $setting = Setting::first();
     $spend = Item::total($this->month, $this->year);
     $cost = Bus::dispatch(new CreateCostCommand($setting->salary, $setting->save, $spend));
     return $this->saveResponse($cost);
 }
开发者ID:nq2916,项目名称:savings,代码行数:18,代码来源:CostController.php

示例5: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     if ($this->confirm("\n****************************************************\nThis will disable LDAP support. You will not be able \nto login with an account that does not exist \nlocally in the Snipe-IT local database. \n****************************************************\n\nDo you wish to continue? [y|N]")) {
         $setting = Setting::first();
         $setting->ldap_enabled = 0;
         if ($setting->save()) {
             $this->info('LDAP has been set to disabled.');
         } else {
             $this->info('Unable to disable LDAP.');
         }
     } else {
         $this->info('Canceled. No actions taken.');
     }
 }
开发者ID:dmeltzer,项目名称:snipe-it,代码行数:19,代码来源:DisableLDAP.php

示例6: up

 /**
  * Migration to pull in LDAP settings from ldap.config into database.
  *
  * @return void
  */
 public function up()
 {
     $settings = \App\Models\Setting::first();
     // Only update the settings record if there IS an LDAP Config
     // AND the Settings table doesn't already have LDAP settings in it
     if (config('ldap.url') && $settings && $settings->ldap_server) {
         $settings->ldap_enabled = 1;
         $settings->ldap_server = config('ldap.url');
         $settings->ldap_uname = config('ldap.username');
         $settings->ldap_pword = Crypt::encrypt(config('ldap.password'));
         $settings->ldap_basedn = config('ldap.basedn');
         $settings->ldap_filter = config('ldap.filter');
         $settings->ldap_username_field = config('ldap.result.username');
         $settings->ldap_lname_field = config('ldap.result.last.name');
         $settings->ldap_fname_field = config('ldap.result.first.name');
         $settings->ldap_auth_filter_query = config('ldap.authentication.filter.query');
         $settings->ldap_version = config('ldap.version');
         $settings->ldap_active_flag = config('ldap.result.active.flag');
         $settings->ldap_emp_num = config('ldap.result.emp.num');
         $settings->ldap_email = config('ldap.result.email');
         // Save the imported settings
         if ($settings->save()) {
             echo 'LDAP settings imported into database' . "\n";
             // Copy the old LDAP config file to prevent any future confusion
             if (@copy(app_path() . '/config/' . app()->environment() . '/ldap.php', app_path() . '/config/' . app()->environment() . '/deprecated.ldap.php')) {
                 if (@unlink(app_path() . '/config/' . app()->environment() . '/ldap.php')) {
                     echo 'Original LDAP file archived to ' . app_path() . '/config/' . app()->environment() . '/deprecated.ldap.php' . "\n";
                 } else {
                     echo 'Could not archive LDAP config file' . "\n";
                 }
             } else {
                 echo 'Could not archive LDAP config file' . "\n";
             }
         }
     }
 }
开发者ID:dmeltzer,项目名称:snipe-it,代码行数:41,代码来源:2015_11_26_195528_import_ldap_settings.php

示例7: getView

 /**
  * Returns a view that presents information about an asset for detail view.
  *
  * @author [A. Gianotto] [<snipe@snipe.net>]
  * @param int $assetId
  * @since [v1.0]
  * @return View
  */
 public function getView($assetId = null)
 {
     $asset = Asset::withTrashed()->find($assetId);
     $settings = Setting::getSettings();
     if (!Company::isCurrentUserHasAccess($asset)) {
         return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
     } elseif ($asset->userloc) {
         $use_currency = $asset->userloc->currency;
     } elseif ($asset->assetloc) {
         $use_currency = $asset->assetloc->currency;
     } else {
         $default_currency = Setting::first()->default_currency;
         if ($settings->default_currency != '') {
             $use_currency = $settings->default_currency;
         } else {
             $use_currency = trans('general.currency');
         }
     }
     if (isset($asset->id)) {
         $qr_code = (object) array('display' => $settings->qr_code == '1', 'url' => route('qr_code/hardware', $asset->id));
         return View::make('hardware/view', compact('asset', 'qr_code', 'settings'))->with('use_currency', $use_currency);
     } else {
         // Prepare the error message
         $error = trans('admin/hardware/message.does_not_exist', compact('id'));
         // Redirect to the user management page
         return redirect()->route('hardware')->with('error', $error);
     }
 }
开发者ID:stijni,项目名称:snipe-it,代码行数:36,代码来源:AssetsController.php

示例8: postEdit

 /**
  * Validate and process settings edit form.
  *
  * @author [A. Gianotto] [<snipe@snipe.net>]
  * @since [v1.0]
  * @return Redirect
  */
 public function postEdit()
 {
     // Check if the asset exists
     if (is_null($setting = Setting::first())) {
         // Redirect to the asset management page with error
         return redirect()->to('admin')->with('error', trans('admin/settings/message.update.error'));
     }
     if (Input::get('clear_logo') == '1') {
         $setting->logo = null;
     } elseif (Input::file('logo_img')) {
         if (!config('app.lock_passwords')) {
             $image = Input::file('logo_img');
             $file_name = "logo." . $image->getClientOriginalExtension();
             $path = public_path('uploads/' . $file_name);
             Image::make($image->getRealPath())->resize(null, 40, function ($constraint) {
                 $constraint->aspectRatio();
                 $constraint->upsize();
             })->save($path);
             $setting->logo = $file_name;
         }
     }
     if (config('app.lock_passwords') == false) {
         $setting->site_name = e(Input::get('site_name'));
         $setting->brand = e(Input::get('brand'));
         $setting->custom_css = e(Input::get('custom_css'));
     }
     if (Input::get('per_page') != '') {
         $setting->per_page = e(Input::get('per_page'));
     } else {
         $setting->per_page = 200;
     }
     $setting->locale = e(Input::get('locale', 'en'));
     $setting->qr_code = e(Input::get('qr_code', '0'));
     $setting->full_multiple_companies_support = e(Input::get('full_multiple_companies_support', '0'));
     $setting->alt_barcode = e(Input::get('alt_barcode'));
     $setting->alt_barcode_enabled = e(Input::get('alt_barcode_enabled', '0'));
     $setting->barcode_type = e(Input::get('barcode_type'));
     $setting->load_remote = e(Input::get('load_remote', '0'));
     $setting->default_currency = e(Input::get('default_currency', '$'));
     $setting->qr_text = e(Input::get('qr_text'));
     $setting->auto_increment_prefix = e(Input::get('auto_increment_prefix'));
     $setting->auto_increment_assets = e(Input::get('auto_increment_assets', '0'));
     $setting->zerofill_count = e(Input::get('zerofill_count'));
     $setting->alert_interval = e(Input::get('alert_interval'));
     $setting->alert_threshold = e(Input::get('alert_threshold'));
     $setting->email_domain = e(Input::get('email_domain'));
     $setting->email_format = e(Input::get('email_format'));
     $setting->username_format = e(Input::get('username_format'));
     $setting->labels_per_page = e(Input::get('labels_per_page'));
     $setting->labels_width = e(Input::get('labels_width'));
     $setting->labels_height = e(Input::get('labels_height'));
     $setting->labels_pmargin_left = e(Input::get('labels_pmargin_left'));
     $setting->labels_pmargin_right = e(Input::get('labels_pmargin_right'));
     $setting->labels_pmargin_top = e(Input::get('labels_pmargin_top'));
     $setting->labels_pmargin_bottom = e(Input::get('labels_pmargin_bottom'));
     $setting->labels_display_bgutter = e(Input::get('labels_display_bgutter'));
     $setting->labels_display_sgutter = e(Input::get('labels_display_sgutter'));
     $setting->labels_fontsize = e(Input::get('labels_fontsize'));
     $setting->labels_pagewidth = e(Input::get('labels_pagewidth'));
     $setting->labels_pageheight = e(Input::get('labels_pageheight'));
     if (Input::has('labels_display_name')) {
         $setting->labels_display_name = 1;
     } else {
         $setting->labels_display_name = 0;
     }
     if (Input::has('labels_display_serial')) {
         $setting->labels_display_serial = 1;
     } else {
         $setting->labels_display_serial = 0;
     }
     if (Input::has('labels_display_tag')) {
         $setting->labels_display_tag = 1;
     } else {
         $setting->labels_display_tag = 0;
     }
     $alert_email = rtrim(Input::get('alert_email'), ',');
     $alert_email = trim(Input::get('alert_email'));
     $setting->alert_email = e($alert_email);
     $setting->alerts_enabled = e(Input::get('alerts_enabled', '0'));
     $setting->header_color = e(Input::get('header_color'));
     $setting->default_eula_text = e(Input::get('default_eula_text'));
     $setting->slack_endpoint = e(Input::get('slack_endpoint'));
     $setting->slack_channel = e(Input::get('slack_channel'));
     $setting->slack_botname = e(Input::get('slack_botname'));
     $setting->ldap_enabled = e(Input::get('ldap_enabled', '0'));
     $setting->ldap_server = e(Input::get('ldap_server'));
     $setting->ldap_server_cert_ignore = e(Input::get('ldap_server_cert_ignore', false));
     $setting->ldap_uname = e(Input::get('ldap_uname'));
     if (Input::has('ldap_pword')) {
         $setting->ldap_pword = Crypt::encrypt(Input::get('ldap_pword'));
     }
     $setting->ldap_basedn = e(Input::get('ldap_basedn'));
     $setting->ldap_filter = Input::get('ldap_filter');
//.........这里部分代码省略.........
开发者ID:stijni,项目名称:snipe-it,代码行数:101,代码来源:SettingsController.php

示例9: exportDeprecationReport

 /**
  * Exports the depreciations to CSV
  *
  * @deprecated Server-side exports have been replaced by datatables export since v2.
  * @author [A. Gianotto] [<snipe@snipe.net>]
  * @since [v1.0]
  * @return \Illuminate\Http\Response
  */
 public function exportDeprecationReport()
 {
     // Grab all the assets
     $assets = Asset::with('model', 'assigneduser', 'assetstatus', 'defaultLoc', 'assetlog')->orderBy('created_at', 'DESC')->get();
     $csv = \League\Csv\Writer::createFromFileObject(new \SplTempFileObject());
     $csv->setOutputBOM(Reader::BOM_UTF16_BE);
     $rows = [];
     // Create the header row
     $header = [trans('admin/hardware/table.asset_tag'), trans('admin/hardware/table.title'), trans('admin/hardware/table.serial'), trans('admin/hardware/table.checkoutto'), trans('admin/hardware/table.location'), trans('admin/hardware/table.purchase_date'), trans('admin/hardware/table.purchase_cost'), trans('admin/hardware/table.book_value'), trans('admin/hardware/table.diff')];
     //we insert the CSV header
     $csv->insertOne($header);
     // Create a row per asset
     foreach ($assets as $asset) {
         $row = [];
         $row[] = e($asset->asset_tag);
         $row[] = e($asset->name);
         $row[] = e($asset->serial);
         if ($asset->assigned_to > 0) {
             $user = User::find($asset->assigned_to);
             $row[] = e($user->fullName());
         } else {
             $row[] = '';
             // Empty string if unassigned
         }
         if ($asset->assigned_to > 0 && $asset->assigneduser->location_id > 0) {
             $location = Location::find($asset->assigneduser->location_id);
             if ($location->city) {
                 $row[] = e($location->city) . ', ' . e($location->state);
             } elseif ($location->name) {
                 $row[] = e($location->name);
             } else {
                 $row[] = '';
             }
         } else {
             $row[] = '';
             // Empty string if location is not set
         }
         if ($asset->assetloc) {
             $currency = e($asset->assetloc->currency);
         } else {
             $currency = e(Setting::first()->default_currency);
         }
         $row[] = $asset->purchase_date;
         $row[] = $currency . Helper::formatCurrencyOutput($asset->purchase_cost);
         $row[] = $currency . Helper::formatCurrencyOutput($asset->getDepreciatedValue());
         $row[] = $currency . Helper::formatCurrencyOutput($asset->purchase_cost - $asset->getDepreciatedValue());
         $csv->insertOne($row);
     }
     $csv->output('depreciation-report-' . date('Y-m-d') . '.csv');
     die;
 }
开发者ID:stijni,项目名称:snipe-it,代码行数:59,代码来源:ReportsController.php

示例10: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     return Setting::first();
 }
开发者ID:nq2916,项目名称:savings,代码行数:9,代码来源:SettingController.php

示例11: store

 /**
  * Validates and stores a new location created via the Create Asset form modal.
  *
  * @todo Check if a Form Request would work better here.
  * @author [A. Gianotto] [<snipe@snipe.net>]
  * @see AssetsController::getCreate() method that makes the form
  * @since [v1.0]
  * @return String JSON
  */
 public function store()
 {
     $new['currency'] = Setting::first()->default_currency;
     // create a new location instance
     $location = new Location();
     // Save the location data
     $location->name = e(Input::get('name'));
     $location->currency = Setting::first()->default_currency;
     //e(Input::get('currency'));
     $location->address = '';
     //e(Input::get('address'));
     // $location->address2			= e(Input::get('address2'));
     $location->city = e(Input::get('city'));
     $location->state = '';
     //e(Input::get('state'));
     $location->country = e(Input::get('country'));
     // $location->zip    			= e(Input::get('zip'));
     $location->user_id = Auth::user()->id;
     // Was the location created?
     if ($location->save()) {
         return JsonResponse::create($location);
     }
     // failure
     $errors = $location->errors();
     return JsonResponse::create(["error" => "Failed validation: " . print_r($location->getErrors(), true)], 500);
 }
开发者ID:dmeltzer,项目名称:snipe-it,代码行数:35,代码来源:LocationsController.php


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