/var/www/hkosl.com/littleark/webadmin/libraies/illuminate/http/Illuminate/Http/RedirectResponse.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<?php namespace Illuminate\Http;

use 
Illuminate\Support\MessageBag;
use 
Symfony\Component\HttpFoundation\Cookie;
use 
Illuminate\Session\Store as SessionStore;
use 
Illuminate\Support\Contracts\MessageProviderInterface;

class 
RedirectResponse extends \Symfony\Component\HttpFoundation\RedirectResponse {

    
/**
     * The request instance.
     *
     * @var \Illuminate\Http\Request
     */
    
protected $request;

    
/**
     * The session store implementation.
     *
     * @var \Illuminate\Session\Store
     */
    
protected $session;

    
/**
     * Set a header on the Response.
     *
     * @param  string  $key
     * @param  string  $value
     * @param  bool  $replace
     * @return \Illuminate\Http\RedirectResponse
     */
    
public function header($key$value$replace true)
    {
        
$this->headers->set($key$value$replace);

        return 
$this;
    }

    
/**
     * Flash a piece of data to the session.
     *
     * @param  string  $key
     * @param  mixed   $value
     * @return \Illuminate\Http\RedirectResponse
     */
    
public function with($key$value null)
    {
        if (
is_array($key))
        {
            foreach (
$key as $k => $v$this->with($k$v);
        }
        else
        {
            
$this->session->flash($key$value);
        }

        return 
$this;
    }

    
/**
     * Add a cookie to the response.
     *
     * @param  \Symfony\Component\HttpFoundation\Cookie  $cookie
     * @return \Illuminate\Http\RedirectResponse
     */
    
public function withCookie(Cookie $cookie)
    {
        
$this->headers->setCookie($cookie);

        return 
$this;
    }

    
/**
     * Flash an array of input to the session.
     *
     * @param  array  $input
     * @return \Illuminate\Http\RedirectResponse
     */
    
public function withInput(array $input null)
    {
        
$input $input ?: $this->request->input();

        
$this->session->flashInput($input);

        return 
$this;
    }

    
/**
     * Flash an array of input to the session.
     *
     * @param  dynamic  string
     * @return \Illuminate\Http\RedirectResponse
     */
    
public function onlyInput()
    {
        return 
$this->withInput($this->request->only(func_get_args()));
    }

    
/**
     * Flash an array of input to the session.
     *
     * @param  dynamic  string
     * @return \Illuminate\Http\RedirectResponse
     */
    
public function exceptInput()
    {
        return 
$this->withInput($this->request->except(func_get_args()));
    }

    
/**
     * Flash a container of errors to the session.
     *
     * @param  \Illuminate\Support\Contracts\MessageProviderInterface|array  $provider
     * @return \Illuminate\Http\RedirectResponse
     */
    
public function withErrors($provider)
    {
        if (
$provider instanceof MessageProviderInterface)
        {
            
$this->with('errors'$provider->getMessageBag());
        }
        else
        {
            
$this->with('errors', new MessageBag((array) $provider));
        }

        return 
$this;
    }

    
/**
     * Get the request instance.
     *
     * @return  \Illuminate\Http\Request
     */
    
public function getRequest()
    {
        return 
$this->request;
    }

    
/**
     * Set the request instance.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return void
     */
    
public function setRequest(Request $request)
    {
        
$this->request $request;
    }

    
/**
     * Get the session store implementation.
     *
     * @return \Illuminate\Session\Store
     */
    
public function getSession()
    {
        return 
$this->session;
    }

    
/**
     * Set the session store implementation.
     *
     * @param  \Illuminate\Session\Store  $store
     * @return void
     */
    
public function setSession(SessionStore $session)
    {
        
$this->session $session;
    }

    
/**
     * Dynamically bind flash data in the session.
     *
     * @param  string  $method
     * @param  array  $parameters
     * @return void
     *
     * @throws \BadMethodCallException
     */
    
public function __call($method$parameters)
    {
        if (
starts_with($method'with'))
        {
            return 
$this->with(snake_case(substr($method4)), $parameters[0]);
        }

        throw new \
BadMethodCallException("Method [$method] does not exist on Redirect.");
    }

}