當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Setting::get方法代碼示例

本文整理匯總了PHP中CachetHQ\Cachet\Facades\Setting::get方法的典型用法代碼示例。如果您正苦於以下問題:PHP Setting::get方法的具體用法?PHP Setting::get怎麽用?PHP Setting::get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CachetHQ\Cachet\Facades\Setting的用法示例。


在下文中一共展示了Setting::get方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: handle

 /**
  * Run the app is setup middleware.
  *
  * We're verifying that Cachet is correctly setup. If it is, then we're
  * redirecting the user to the dashboard so they can use Cachet.
  *
  * @param \Illuminate\Routing\Route $route
  * @param \Closure                  $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Setting::get('app_name')) {
         return Redirect::to('dashboard');
     }
     return $next($request);
 }
開發者ID:minhkiller,項目名稱:Cachet,代碼行數:18,代碼來源:AppIsSetup.php

示例2: compose

 /**
  * Index page view composer.
  *
  * @param \Illuminate\Contracts\View\View $view
  *
  * @return void
  */
 public function compose(View $view)
 {
     $isEnabled = (bool) Setting::get('enable_subscribers', false);
     $mailAddress = env('MAIL_ADDRESS', false);
     $mailFrom = env('MAIL_NAME', false);
     $view->withSubscribersEnabled($isEnabled && $mailAddress && $mailFrom);
 }
開發者ID:practico,項目名稱:Cachet,代碼行數:14,代碼來源:AppComposer.php

示例3: boot

 /**
  * Boot the service provider.
  */
 public function boot()
 {
     $appDomain = $appLocale = null;
     try {
         // Get app custom configuration.
         $appDomain = Setting::get('app_domain');
         $appLocale = Setting::get('app_locale');
         // Set the Segment.com settings.
         if (Setting::get('app_track')) {
             $segmentRepository = $this->app->make('CachetHQ\\Cachet\\Segment\\RepositoryInterface');
             $this->app->config->set('segment.write_key', $segmentRepository->fetch());
         }
         // Setup Cors.
         $allowedOrigins = $this->app->config->get('cors.defaults.allowedOrigins');
         $allowedOrigins[] = Setting::get('app_domain');
         // Add our allowed domains too.
         if ($allowedDomains = Setting::get('allowed_domains')) {
             $domains = explode(',', $allowedDomains);
             foreach ($domains as $domain) {
                 $allowedOrigins[] = $domain;
             }
         } else {
             $allowedOrigins[] = env('APP_URL');
         }
         $this->app->config->set('cors.paths.api/v1/*.allowedOrigins', $allowedOrigins);
     } catch (Exception $e) {
         // Don't throw any errors, we may not be setup yet.
     }
     // Override default app values.
     $this->app->config->set('app.url', $appDomain ?: $this->app->config->get('app.url'));
     $this->app->config->set('app.locale', $appLocale ?: $this->app->config->get('app.locale'));
     // Set custom lang.
     $this->app->translator->setLocale($appLocale);
 }
開發者ID:hd-deman,項目名稱:Cachet,代碼行數:37,代碼來源:ConfigServiceProvider.php

示例4: boot

 /**
  * Boot the service provider.
  *
  * @return void
  */
 public function boot()
 {
     $appDomain = $appLocale = $appTimezone = null;
     try {
         // Get app custom configuration.
         $appDomain = Setting::get('app_domain');
         $appLocale = Setting::get('app_locale');
         $appTimezone = Setting::get('app_timezone');
         // Setup Cors.
         $allowedOrigins = $this->app->config->get('cors.defaults.allowedOrigins');
         $allowedOrigins[] = Setting::get('app_domain');
         // Add our allowed domains too.
         if ($allowedDomains = Setting::get('allowed_domains')) {
             $domains = explode(',', $allowedDomains);
             foreach ($domains as $domain) {
                 $allowedOrigins[] = $domain;
             }
         } else {
             $allowedOrigins[] = $this->app->config->get('app.url');
         }
         $this->app->config->set('cors.paths.api/v1/*.allowedOrigins', $allowedOrigins);
     } catch (Exception $e) {
         // Don't throw any errors, we may not be setup yet.
     }
     // Override default app values.
     $this->app->config->set('app.url', $appDomain ?: $this->app->config->get('app.url'));
     $this->app->config->set('app.locale', $appLocale ?: $this->app->config->get('app.locale'));
     $this->app->config->set('cachet.timezone', $appTimezone ?: $this->app->config->get('cachet.timezone'));
     // Set custom lang.
     $this->app->translator->setLocale($appLocale);
 }
開發者ID:reginaldojunior,項目名稱:Cachet,代碼行數:36,代碼來源:ConfigServiceProvider.php

示例5: env

 /**
  * Is the subscriber functionality enabled and configured.
  *
  * @return bool
  */
 function subscribers_enabled()
 {
     $isEnabled = Setting::get('enable_subscribers', false);
     $mailAddress = env('MAIL_ADDRESS', false);
     $mailFrom = env('MAIL_NAME', false);
     return $isEnabled && $mailAddress && $mailFrom;
 }
開發者ID:n0mer,項目名稱:Cachet,代碼行數:12,代碼來源:helpers.php

示例6: getValuesByHour

 /**
  * Returns the sum of all values a metric has by the hour.
  *
  * @param int $hour
  *
  * @return int
  */
 public function getValuesByHour($hour)
 {
     $dateTimeZone = SettingFacade::get('app_timezone');
     $dateTime = (new Date())->setTimezone($dateTimeZone)->sub(new DateInterval('PT' . $hour . 'H'));
     $hourInterval = $dateTime->format('YmdH');
     if (Config::get('database.default') === 'mysql') {
         if (!isset($this->calc_type) || $this->calc_type == self::CALC_SUM) {
             $value = (int) $this->points()->whereRaw('DATE_FORMAT(created_at, "%Y%m%d%H") = ' . $hourInterval)->groupBy(DB::raw('HOUR(created_at)'))->sum('value');
         } elseif ($this->calc_type == self::CALC_AVG) {
             $value = (int) $this->points()->whereRaw('DATE_FORMAT(created_at, "%Y%m%d%H") = ' . $hourInterval)->groupBy(DB::raw('HOUR(created_at)'))->avg('value');
         }
     } else {
         // Default metrics calculations.
         if (!isset($this->calc_type) || $this->calc_type == self::CALC_SUM) {
             $queryType = 'sum(metric_points.value)';
         } elseif ($this->calc_type == self::CALC_AVG) {
             $queryType = 'avg(metric_points.value)';
         } else {
             $queryType = 'sum(metric_points.value)';
         }
         $query = DB::select("select {$queryType} as aggregate FROM metrics JOIN metric_points ON metric_points.metric_id = metrics.id WHERE metric_points.metric_id = {$this->id} AND to_char(metric_points.created_at, 'YYYYMMDDHH24') = :timestamp GROUP BY to_char(metric_points.created_at, 'H')", ['timestamp' => $hourInterval]);
         if (isset($query[0])) {
             $value = $query[0]->aggregate;
         } else {
             $value = 0;
         }
     }
     if ($value === 0 && $this->default_value != $value) {
         return $this->default_value;
     }
     return $value;
 }
開發者ID:nguyentamvinhlong,項目名稱:Cachet,代碼行數:39,代碼來源:Metric.php

示例7:

 /**
  * Is the subscriber functionality enabled and configured.
  *
  * @return bool
  */
 function subscribers_enabled()
 {
     $isEnabled = Setting::get('enable_subscribers', false);
     $mailAddress = Config::get('mail.from.address', false);
     $mailFrom = Config::get('mail.from.name', false);
     return $isEnabled && $mailAddress && $mailFrom;
 }
開發者ID:guduchango,項目名稱:Cachet,代碼行數:12,代碼來源:helpers.php

示例8: fetch

 /**
  * Returns the segment write key.
  *
  * @return string
  */
 public function fetch()
 {
     $writeKey = null;
     try {
         // Firstly, does the setting exist?
         if (null === ($writeKey = Setting::get('segment_write_key'))) {
             // No, let's go fetch it.
             $writeKey = $this->repository->fetch();
             Setting::set('segment_write_key', $writeKey);
         } else {
             // It does, but how old is it?
             $setting = SettingModel::where('name', 'segment_write_key')->first();
             // It's older than an hour, let's refresh
             if ($setting->updated_at->lt(Carbon::now()->subHour())) {
                 $writeKey = $this->repository->fetch();
                 // Update the setting. This is done manual to make sure updated_at is overwritten.
                 $setting->value = $writeKey;
                 $setting->updated_at = Carbon::now();
                 $setting->save();
             }
         }
     } catch (QueryException $e) {
         // Just return it until we're setup.
         $writeKey = $this->repository->fetch();
     }
     return $writeKey;
 }
開發者ID:hd-deman,項目名稱:Cachet,代碼行數:32,代碼來源:CacheRepository.php

示例9: compose

 /**
  * Index page view composer.
  *
  * @param \Illuminate\Contracts\View\View $view
  *
  * @return void
  */
 public function compose(View $view)
 {
     $isEnabled = (bool) Setting::get('enable_subscribers', false);
     $mailAddress = env('MAIL_ADDRESS', false);
     $mailFrom = env('MAIL_NAME', false);
     $view->withSubscribersEnabled($isEnabled && $mailAddress && $mailFrom);
     $view->withAboutApp(Markdown::convertToHtml(Setting::get('app_about')));
 }
開發者ID:ramirors,項目名稱:Cachet,代碼行數:15,代碼來源:AppComposer.php

示例10: handle

 /**
  * We're verifying that subscribers is both enabled and configured.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $isEnabled = Setting::get('enable_subscribers', false);
     $mailAddress = env('MAIL_ADDRESS', false);
     $mailFrom = env('MAIL_NAME', false);
     if (!($isEnabled && $mailAddress && $mailFrom)) {
         return Redirect::route('status-page');
     }
     return $next($request);
 }
開發者ID:hd-deman,項目名稱:Cachet,代碼行數:18,代碼來源:SubscribersConfigured.php

示例11: handle

 /**
  * Handle the report maintenance command.
  *
  * @param \CachetHQ\Cachet\Commands\Incident\ReportMaintenanceCommand $command
  *
  * @return \CachetHQ\Cachet\Models\Incident
  */
 public function handle(ReportMaintenanceCommand $command)
 {
     // TODO: Add validation to scheduledAt
     $scheduledAt = Date::createFromFormat('d/m/Y H:i', $command->timestamp, Setting::get('app_timezone'))->setTimezone(Config::get('app.timezone'));
     $maintenanceEvent = Incident::create(['name' => $command->name, 'message' => $command->message, 'scheduled_at' => $scheduledAt, 'status' => 0, 'visible' => 1]);
     // Notify subscribers.
     if ($command->notify) {
         event(new MaintenanceWasScheduledEvent($maintenanceEvent));
     }
     return $maintenanceEvent;
 }
開發者ID:practico,項目名稱:Cachet,代碼行數:18,代碼來源:ReportMaintenanceCommandHandler.php

示例12: compose

 /**
  * Bind data to the view.
  *
  * @param \Illuminate\Contracts\View\View $view
  */
 public function compose(View $view)
 {
     $view->withThemeBackgroundColor(Setting::get('style_background_color'));
     $view->withThemeTextColor(Setting::get('style_text_color'));
     $viewData = $view->getData();
     $themeView = array_only($viewData, preg_grep('/^theme/', array_keys($viewData)));
     $hasThemeSettings = array_filter($themeView, function ($data) {
         return $data != null;
     });
     $view->withThemeSetup(!empty($hasThemeSettings));
 }
開發者ID:RetinaInc,項目名稱:Cachet,代碼行數:16,代碼來源:ThemeComposer.php

示例13: getSignup

 /**
  * Handle the signup with invite.
  *
  * @param string|null $code
  *
  * @return \Illuminate\View\View
  */
 public function getSignup($code = null)
 {
     if (is_null($code)) {
         throw new NotFoundHttpException();
     }
     $invite = Invite::where('code', '=', $code)->first();
     if (!$invite || $invite->claimed()) {
         throw new BadRequestHttpException();
     }
     return View::make('signup')->withPageTitle(Setting::get('app_name'))->withAboutApp(Markdown::convertToHtml(Setting::get('app_about')))->withCode($invite->code)->withUsername(Binput::old('username'))->withEmail(Binput::old('emai', $invite->email));
 }
開發者ID:blumtech,項目名稱:Cachet,代碼行數:18,代碼來源:SignupController.php

示例14: handle

 /**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     try {
         if (!Setting::get('app_name')) {
             return Redirect::to('setup');
         }
     } catch (Exception $e) {
         return Redirect::to('setup');
     }
     return $next($request);
 }
開發者ID:CMNatic,項目名稱:Cachet,代碼行數:19,代碼來源:ReadyForUse.php

示例15: compose

 /**
  * Metrics view composer.
  *
  * @param \Illuminate\Contracts\View\View $view
  *
  * @return void
  */
 public function compose(View $view)
 {
     $metrics = null;
     $metricData = [];
     if ($displayMetrics = Setting::get('display_graphs')) {
         $metrics = Metric::where('display_chart', 1)->get();
         $metrics->map(function ($metric) use(&$metricData) {
             $metricData[$metric->id] = ['today' => $this->metricRepository->listPointsToday($metric), 'week' => $this->metricRepository->listPointsForWeek($metric), 'month' => $this->metricRepository->listPointsForMonth($metric)];
         });
     }
     $view->withDisplayMetrics($displayMetrics)->withMetrics($metrics)->withMetricData($metricData);
 }
開發者ID:guduchango,項目名稱:Cachet,代碼行數:19,代碼來源:MetricsComposer.php


注:本文中的CachetHQ\Cachet\Facades\Setting::get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。