本文整理汇总了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;
}
}
示例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);
}
}
}