當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。