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


PHP Binput::has方法代码示例

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


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

示例1: getMetrics

 /**
  * Get all metrics.
  *
  * @return \Illuminate\Database\Eloquent\Collection
  */
 public function getMetrics()
 {
     $metrics = Metric::query();
     if ($sortBy = Binput::get('sort')) {
         $direction = Binput::has('order') && Binput::get('order') == 'desc';
         $metrics->sort($sortBy, $direction);
     }
     $metrics = $metrics->paginate(Binput::get('per_page', 20));
     return $this->paginator($metrics, Request::instance());
 }
开发者ID:aksalj,项目名称:Cachet,代码行数:15,代码来源:MetricController.php

示例2: getGroups

 /**
  * Get all groups.
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function getGroups()
 {
     $groups = ComponentGroup::query();
     $groups->search(Binput::except(['sort', 'order', 'per_page']));
     if ($sortBy = Binput::get('sort')) {
         $direction = Binput::has('order') && Binput::get('order') == 'desc';
         $groups->sort($sortBy, $direction);
     }
     $groups = $groups->paginate(Binput::get('per_page', 20));
     return $this->paginator($groups, Request::instance());
 }
开发者ID:aksalj,项目名称:Cachet,代码行数:16,代码来源:ComponentGroupController.php

示例3: getIncidents

 /**
  * Get all incidents.
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function getIncidents()
 {
     $incidentVisibility = app(Guard::class)->check() ? 0 : 1;
     $incidents = Incident::where('visible', '>=', $incidentVisibility);
     $incidents->search(Binput::except(['sort', 'order', 'per_page']));
     if ($sortBy = Binput::get('sort')) {
         $direction = Binput::has('order') && Binput::get('order') == 'desc';
         $incidents->sort($sortBy, $direction);
     }
     $incidents = $incidents->paginate(Binput::get('per_page', 20));
     return $this->paginator($incidents, Request::instance());
 }
开发者ID:aksalj,项目名称:Cachet,代码行数:17,代码来源:IncidentController.php

示例4: showIndex

 /**
  * Returns the rendered Blade templates.
  *
  * @return \Illuminate\View\View
  */
 public function showIndex()
 {
     $today = Date::now();
     $startDate = Date::now();
     segment_page('Status Page');
     // Check if we have another starting date
     if (Binput::has('start_date')) {
         try {
             // If date provided is valid
             $oldDate = Date::createFromFormat('Y-m-d', Binput::get('start_date'));
             segment_track('Status Page', ['start_date' => $oldDate->format('Y-m-d')]);
             // If trying to get a future date fallback to today
             if ($today->gt($oldDate)) {
                 $startDate = $oldDate;
             }
         } catch (Exception $e) {
             // Fallback to today
         }
     }
     $metrics = null;
     if ($displayMetrics = Setting::get('display_graphs')) {
         $metrics = Metric::where('display_chart', 1)->get();
     }
     $daysToShow = Setting::get('app_incident_days') ?: 7;
     $incidentDays = range(0, $daysToShow - 1);
     $dateTimeZone = Setting::get('app_timezone');
     $incidentVisiblity = Auth::check() ? 0 : 1;
     $allIncidents = Incident::notScheduled()->where('visible', '>=', $incidentVisiblity)->whereBetween('created_at', [$startDate->copy()->subDays($daysToShow)->format('Y-m-d') . ' 00:00:00', $startDate->format('Y-m-d') . ' 23:59:59'])->orderBy('created_at', 'desc')->get()->groupBy(function (Incident $incident) use($dateTimeZone) {
         return (new Date($incident->created_at))->setTimezone($dateTimeZone)->toDateString();
     });
     // Add in days that have no incidents
     foreach ($incidentDays as $i) {
         $date = (new Date($startDate))->setTimezone($dateTimeZone)->subDays($i);
         if (!isset($allIncidents[$date->toDateString()])) {
             $allIncidents[$date->toDateString()] = [];
         }
     }
     // Sort the array so it takes into account the added days
     $allIncidents = $allIncidents->sortBy(function ($value, $key) {
         return strtotime($key);
     }, SORT_REGULAR, true)->all();
     // Scheduled maintenance code.
     $scheduledMaintenance = Incident::scheduled()->orderBy('scheduled_at')->get();
     // Component & Component Group lists.
     $usedComponentGroups = Component::where('group_id', '>', 0)->groupBy('group_id')->lists('group_id');
     $componentGroups = ComponentGroup::whereIn('id', $usedComponentGroups)->orderBy('order')->get();
     $ungroupedComponents = Component::where('group_id', 0)->orderBy('order')->orderBy('created_at')->get();
     $canPageBackward = Incident::notScheduled()->where('created_at', '<', $startDate->format('Y-m-d'))->count() != 0;
     return View::make('index', ['componentGroups' => $componentGroups, 'ungroupedComponents' => $ungroupedComponents, 'displayMetrics' => $displayMetrics, 'metrics' => $metrics, 'allIncidents' => $allIncidents, 'scheduledMaintenance' => $scheduledMaintenance, 'aboutApp' => Markdown::convertToHtml(Setting::get('app_about')), 'canPageForward' => (bool) $today->gt($startDate), 'canPageBackward' => $canPageBackward, 'previousDate' => $startDate->copy()->subDays($daysToShow)->toDateString(), 'nextDate' => $startDate->copy()->addDays($daysToShow)->toDateString(), 'pageTitle' => Setting::get('app_name') . ' Status']);
 }
开发者ID:2bj,项目名称:Cachet,代码行数:55,代码来源:HomeController.php

示例5: showIndex

 /**
  * Displays the explore page.
  *
  * @return \Illuminate\View\View
  */
 public function showIndex()
 {
     $today = Date::now();
     $startDate = Date::now();
     // Check if we have another starting date
     if (Binput::has('start_date')) {
         try {
             // If date provided is valid
             $oldDate = Date::createFromFormat('Y-m-d', Binput::get('start_date'));
             // If trying to get a future date fallback to today
             if ($today->gt($oldDate)) {
                 $startDate = $oldDate;
             }
         } catch (Exception $e) {
             // Fallback to today
         }
     }
     $daysToShow = Setting::get('app_issue_days', 0) - 1;
     if ($daysToShow < 0) {
         $daysToShow = 0;
         $issueDays = [];
     } else {
         $issueDays = range(0, $daysToShow);
     }
     $dateTimeZone = Setting::get('app_timezone');
     $issueVisiblity = Auth::check() ? 0 : 1;
     $allIssues = Issue::where('visible', '>=', $issueVisiblity)->whereBetween('created_at', [$startDate->copy()->subDays($daysToShow)->format('Y-m-d') . ' 00:00:00', $startDate->format('Y-m-d') . ' 23:59:59'])->orderBy('scheduled_at', 'desc')->orderBy('created_at', 'desc')->get()->groupBy(function (Issue $issue) use($dateTimeZone) {
         // If it's scheduled, get the scheduled at date.
         if ($issue->is_scheduled) {
             return (new Date($issue->scheduled_at))->setTimezone($dateTimeZone)->toDateString();
         }
         return (new Date($issue->created_at))->setTimezone($dateTimeZone)->toDateString();
     });
     // Add in days that have no issues
     foreach ($issueDays as $i) {
         $date = (new Date($startDate))->setTimezone($dateTimeZone)->subDays($i);
         if (!isset($allIssues[$date->toDateString()])) {
             $allIssues[$date->toDateString()] = [];
         }
     }
     // Sort the array so it takes into account the added days
     $allIssues = $allIssues->sortBy(function ($value, $key) {
         return strtotime($key);
     }, SORT_REGULAR, true)->all();
     return View::make('index')->withDaysToShow($daysToShow)->withAllIssues($allIssues)->withCanPageForward((bool) $today->gt($startDate))->withCanPageBackward(Issue::where('created_at', '<', $startDate->format('Y-m-d'))->count() > 0)->withPreviousDate($startDate->copy()->subDays($daysToShow)->toDateString())->withNextDate($startDate->copy()->addDays($daysToShow)->toDateString());
 }
开发者ID:emtudo,项目名称:Gitamin,代码行数:51,代码来源:ExploreController.php

示例6: putComponent

 /**
  * Update an existing component.
  *
  * @param \CachetHQ\Cachet\Models\Componet $component
  *
  * @return \CachetHQ\Cachet\Models\Component
  */
 public function putComponent(Component $component)
 {
     try {
         $component->update(Binput::except('tags'));
     } catch (Exception $e) {
         throw new BadRequestHttpException();
     }
     if (Binput::has('tags')) {
         $tags = preg_split('/ ?, ?/', Binput::get('tags'));
         // For every tag, do we need to create it?
         $componentTags = array_map(function ($taggable) use($component) {
             return Tag::firstOrCreate(['name' => $taggable])->id;
         }, $tags);
         $component->tags()->sync($componentTags);
     }
     return $this->item($component);
 }
开发者ID:kulado,项目名称:Cachet,代码行数:24,代码来源:ComponentController.php

示例7: postSettings

 /**
  * Updates the status page settings.
  *
  * @return \Illuminate\View\View
  */
 public function postSettings()
 {
     $redirectUrl = Session::get('redirect_to', route('dashboard.settings.setup'));
     if (Binput::get('remove_banner') === '1') {
         $setting = Setting::where('name', 'app_banner');
         $setting->delete();
     }
     if (Binput::hasFile('app_banner')) {
         $file = Binput::file('app_banner');
         // Image Validation.
         // Image size in bytes.
         $maxSize = $file->getMaxFilesize();
         if ($file->getSize() > $maxSize) {
             return Redirect::to($redirectUrl)->withErrors(trans('dashboard.settings.app-setup.too-big', ['size' => $maxSize]));
         }
         if (!$file->isValid() || $file->getError()) {
             return Redirect::to($redirectUrl)->withErrors($file->getErrorMessage());
         }
         if (!starts_with($file->getMimeType(), 'image/')) {
             return Redirect::to($redirectUrl)->withErrors(trans('dashboard.settings.app-setup.images-only'));
         }
         // Store the banner.
         Setting::firstOrCreate(['name' => 'app_banner'])->update(['value' => base64_encode(file_get_contents($file->getRealPath()))]);
         // Store the banner type
         Setting::firstOrCreate(['name' => 'app_banner_type'])->update(['value' => $file->getMimeType()]);
     }
     try {
         foreach (Binput::except(['app_banner', 'remove_banner']) as $settingName => $settingValue) {
             if ($settingName === 'app_analytics_pi_url') {
                 $settingValue = rtrim($settingValue, '/');
             }
             Setting::firstOrCreate(['name' => $settingName])->update(['value' => $settingValue]);
         }
     } catch (Exception $e) {
         return Redirect::to($redirectUrl)->withErrors(trans('dashboard.settings.edit.failure'));
     }
     if (Binput::has('app_locale')) {
         Lang::setLocale(Binput::get('app_locale'));
     }
     return Redirect::to($redirectUrl)->withSuccess(trans('dashboard.settings.edit.success'));
 }
开发者ID:guduchango,项目名称:Cachet,代码行数:46,代码来源:SettingsController.php

示例8: putComponent

 /**
  * Update an existing component.
  *
  * @param \CachetHQ\Cachet\Models\Component $component
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function putComponent(Component $component)
 {
     try {
         dispatch(new UpdateComponentCommand($component, Binput::get('name'), Binput::get('description'), Binput::get('status'), Binput::get('link'), Binput::get('order'), Binput::get('group_id'), (bool) Binput::get('enabled', true)));
     } catch (QueryException $e) {
         throw new BadRequestHttpException();
     }
     if (Binput::has('tags')) {
         $tags = preg_split('/ ?, ?/', Binput::get('tags'));
         // For every tag, do we need to create it?
         $componentTags = array_map(function ($taggable) use($component) {
             return Tag::firstOrCreate(['name' => $taggable])->id;
         }, $tags);
         $component->tags()->sync($componentTags);
     }
     return $this->item($component);
 }
开发者ID:mohitsethi,项目名称:Cachet,代码行数:24,代码来源:ComponentController.php

示例9: postSettings

 /**
  * Updates the status page settings.
  *
  * @return \Illuminate\View\View
  */
 public function postSettings()
 {
     $setting = app(Repository::class);
     if (Binput::get('remove_banner') === '1') {
         $setting->set('app_banner', null);
     }
     $parameters = Binput::all();
     if (isset($parameters['header'])) {
         if ($header = Binput::get('header', null, false, false)) {
             $setting->set('header', $header);
         } else {
             $setting->delete('header');
         }
     }
     if (isset($parameters['footer'])) {
         if ($footer = Binput::get('footer', null, false, false)) {
             $setting->set('footer', $footer);
         } else {
             $setting->delete('footer');
         }
     }
     if (Binput::hasFile('app_banner')) {
         $this->handleUpdateBanner($setting);
     }
     $excludedParams = ['_token', 'app_banner', 'remove_banner', 'header', 'footer'];
     try {
         foreach (Binput::except($excludedParams) as $settingName => $settingValue) {
             if ($settingName === 'app_analytics_pi_url') {
                 $settingValue = rtrim($settingValue, '/');
             }
             $setting->set($settingName, $settingValue);
         }
     } catch (Exception $e) {
         return Redirect::back()->withErrors(trans('dashboard.settings.edit.failure'));
     }
     if (Binput::has('app_locale')) {
         Lang::setLocale(Binput::get('app_locale'));
     }
     return Redirect::back()->withSuccess(trans('dashboard.settings.edit.success'));
 }
开发者ID:aksalj,项目名称:Cachet,代码行数:45,代码来源:SettingsController.php

示例10: postSettings

 /**
  * Updates the status page settings.
  *
  * @return \Illuminate\View\View
  */
 public function postSettings()
 {
     $redirectUrl = Session::get('redirect_to', route('dashboard.settings.setup'));
     $setting = app('setting');
     if (Binput::get('remove_banner') === '1') {
         $setting->set('app_banner', null);
     }
     if ($header = Binput::get('header', null, false, false)) {
         $setting->set('header', $header);
     }
     if ($footer = Binput::get('footer', null, false, false)) {
         $setting->set('footer', $footer);
     }
     if (Binput::hasFile('app_banner')) {
         $file = Binput::file('app_banner');
         // Image Validation.
         // Image size in bytes.
         $maxSize = $file->getMaxFilesize();
         if ($file->getSize() > $maxSize) {
             return Redirect::to($redirectUrl)->withErrors(trans('dashboard.settings.app-setup.too-big', ['size' => $maxSize]));
         }
         if (!$file->isValid() || $file->getError()) {
             return Redirect::to($redirectUrl)->withErrors($file->getErrorMessage());
         }
         if (!starts_with($file->getMimeType(), 'image/')) {
             return Redirect::to($redirectUrl)->withErrors(trans('dashboard.settings.app-setup.images-only'));
         }
         // Store the banner.
         $setting->set('app_banner', base64_encode(file_get_contents($file->getRealPath())));
         // Store the banner type.
         $setting->set('app_banner_type', $file->getMimeType());
     }
     $excludedParams = ['_token', 'app_banner', 'remove_banner', 'header', 'footer'];
     try {
         foreach (Binput::except($excludedParams) as $settingName => $settingValue) {
             if ($settingName === 'app_analytics_pi_url') {
                 $settingValue = rtrim($settingValue, '/');
             }
             $setting->set($settingName, $settingValue);
         }
     } catch (Exception $e) {
         return Redirect::to($redirectUrl)->withErrors(trans('dashboard.settings.edit.failure'));
     }
     if (Binput::has('app_locale')) {
         Lang::setLocale(Binput::get('app_locale'));
     }
     return Redirect::to($redirectUrl)->withSuccess(trans('dashboard.settings.edit.success'));
 }
开发者ID:R11T,项目名称:Cachet,代码行数:53,代码来源:SettingsController.php


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