[李景山php]每天laravel-20161019|RedirectResponse.php-2
来源:互联网 发布:莱斯特城奇迹 知乎 编辑:程序博客网 时间:2024/06/05 04:05
/** * Add multiple cookies to the response. * * @param array $cookies * @return $this */ public function withCookies(array $cookies) { foreach ($cookies as $cookie) { $this->headers->setCookie($cookie); }// loop cookie array, return $this; }// Add multiple cookies /** * Flash an array of input to the session. * * @param array $input * @return $this */ public function withInput(array $input = null) { $input = $input ?: $this->request->input();//$input and the request input $this->session->flashInput($data = array_filter($input, $callback = function (&$value) use (&$callback) { if (is_array($value)) { $value = array_filter($value, $callback); }// use this recursion function return ! $value instanceof SymfonyUploadedFile; }));// loop this input, and been filter by callback default function is a return $this;// return this instance }//flash an array of input to the session /** * Flash an array of input to the session. * * @param mixed string * @return $this */ public function onlyInput() { return $this->withInput($this->request->only(func_get_args())); }// first get the parameters about all insert // and then get the only,and then get the input /** * Flash an array of input to the session. * * @param mixed string * @return \Illuminate\Http\RedirectResponse */ public function exceptInput() { return $this->withInput($this->request->except(func_get_args())); }// flash an except array of input to the session /** * Flash a container of errors to the session. * * @param \Illuminate\Contracts\Support\MessageProvider|array|string $provider * @param string $key * @return $this */ public function withErrors($provider, $key = 'default') { $value = $this->parseErrors($provider);// value like parse Errors $this->session->flash( 'errors', $this->session->get('errors', new ViewErrorBag)->put($key, $value) );//a wrap function return $this; }//flash a error and errors, /** * Parse the given errors into an appropriate value. * * @param \Illuminate\Contracts\Support\MessageProvider|array|string $provider * @return \Illuminate\Support\MessageBag */ protected function parseErrors($provider) { if ($provider instanceof MessageProvider) { return $provider->getMessageBag(); }// type 1//type 2 return new MessageBag((array) $provider); }// parse the given errors into an appropriate value /** * Get the request instance. * * @return \Illuminate\Http\Request|null */ public function getRequest() { return $this->request; }// big get /** * Set the request instance. * * @param \Illuminate\Http\Request $request * @return void */ public function setRequest(Request $request) { $this->request = $request; }// big set /** * Get the session store implementation. * * @return \Illuminate\Session\Store|null */ public function getSession() { return $this->session; }// get session /** * Set the session store implementation. * * @param \Illuminate\Session\Store $session * @return void */ public function setSession(SessionStore $session) { $this->session = $session; }// set session /** * Dynamically bind flash data in the session. * * @param string $method * @param array $parameters * @return $this * * @throws \BadMethodCallException */ public function __call($method, $parameters) { if (Str::startsWith($method, 'with')) { return $this->with(Str::snake(substr($method, 4)), $parameters[0]); }// a magic function throw new BadMethodCallException("Method [$method] does not exist on Redirect."); }// Dynamically bind flash data in the session}
0 0
- [李景山php]每天laravel-20161019|RedirectResponse.php-2
- [李景山php]每天laravel-20161018|RedirectResponse.php-1
- [李景山php]每天laravel-20160828|McryptEncrypter-2
- [李景山php]每天laravel-20160902|Dispatcher-2
- [李景山php]每天laravel-20160911|FileSystem-2
- [李景山php]每天laravel-20160915|FileSystemManager-2
- [李景山php]每天laravel-20160920|Writer-2
- [李景山php]每天laravel-20161002|Validator.php-2
- [李景山php]每天laravel-20161021|Request.php-2
- [李景山php]每天laravel-20161103|CompilerEngine.php-2
- [李景山php]每天laravel-20161118|ConnectionFatory.php-2
- [李景山php]每天laravel-20161130|BelongsToMany.php-2
- [李景山php]每天laravel-20160922|RedisServicProvider.php
- [李景山php]每天laravel-20160923|Hub.php
- [李景山php]每天laravel-20160924|PiplineServiceProvider.php
- [李景山php]每天laravel-20160925|Pipeline.php
- [李景山php]每天laravel-20160926|DatabasePresenceVerifier.php
- [李景山php]每天laravel-20160927|Factory.php
- sklearn pipeline简介
- Java Arrays类的使用
- Binary Tree Zigzag Level Order Traversal
- UVA 1585解题报告
- [bzoj1037][DP]生日聚会party
- [李景山php]每天laravel-20161019|RedirectResponse.php-2
- [spfa+判负环]poj3259 Wormholes
- 手机端点击图片放大特效-PhotoSwipe插件
- 关于Relay Log无法自动删除的问题
- 计算机基础八之计算机系统
- 【Spring揭秘】------ 第一章学习 Spring框架的由来
- 玩转windows命令
- word中的表格怎么按照章节自动插入题注(即表头的编号)
- 【android studio开发过程问题集锦】