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


PHP Flash::all方法代码示例

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


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

示例1: onShowFlashMsg

 public function onShowFlashMsg()
 {
     $msg = \Flash::all();
     if ($msg) {
         $res['msgs'] = $msg;
         if ($this->property('configuration')) {
             $data = FlashConfigur::find($this->property('configuration'))->toArray();
             $conf = $this->combineSettings($data);
             $res['options'] = $conf['options'];
             $res['settings'] = $conf['settings'];
         } else {
             $res['options'] = [];
             $res['settings'] = [];
         }
         return $res;
     }
 }
开发者ID:janusnic,项目名称:octobercms_flashmessage,代码行数:17,代码来源:FlashMessage.php

示例2: ajaxAction

 /**
  * @return \Symfony\Component\HttpFoundation\Response
  */
 protected function ajaxAction()
 {
     if ($this->request->header('X-Remote') && $this->request->wantsJson()) {
         try {
             $responseContents = [];
             $result = call_user_func_array([$this, $this->action], $this->params);
             $responseContents['success'] = true;
             if (is_array($result)) {
                 $responseContents = array_merge($responseContents, $result);
             } elseif (is_string($result)) {
                 $responseContents['result'] = $result;
             }
             if ($result instanceof RedirectResponse) {
                 $responseContents['REDIRECT'] = $result->getTargetUrl();
             } elseif (\Flash::check()) {
                 $types = ['success', 'info', 'error', 'warning'];
                 foreach (\Flash::all() as $type => $message) {
                 }
                 if (\Flash::get('success')) {
                     $responseContents['FLASH']['success'] = \Flash::first('success');
                 }
                 if (\Flash::get('info')) {
                     $responseContents['FLASH']['info'] = \Flash::first('info');
                 }
                 if (\Flash::get('error')) {
                     $responseContents['FLASH']['danger'] = \Flash::first('error');
                 }
                 if (\Flash::get('warning')) {
                     $responseContents['FLASH']['warning'] = \Flash::first('warning');
                 }
             }
             return response()->make()->setContent($responseContents);
         } catch (ValidationException $ex) {
             \Flash::error($ex->getMessage());
             $responseContents = [];
             $responseContents['success'] = false;
             $responseContents['FLASH']['danger'] = \Flash::first('error');
             $responseContents['ERROR_FIELDS'] = $ex->getFields();
             return response()->make()->setContent($responseContents);
         }
     }
 }
开发者ID:spetross,项目名称:ugvoice,代码行数:45,代码来源:AppController.php


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