1 | <?php |
||
20 | class Response |
||
21 | { |
||
22 | /** |
||
23 | * @var bool |
||
24 | */ |
||
25 | public $status = true; |
||
26 | |||
27 | /** |
||
28 | * @var \Exception |
||
29 | */ |
||
30 | public $exception; |
||
31 | |||
32 | /** |
||
33 | * @var array |
||
34 | */ |
||
35 | public $toastrMethods = [ |
||
36 | 'topCenter', 'topLeft', 'topRight', |
||
37 | 'bottomLeft', 'bottomCenter', 'bottomRight', |
||
38 | 'topFullWidth', 'bottomFullWidth', 'timeout', |
||
39 | ]; |
||
40 | |||
41 | /** |
||
42 | * @var |
||
43 | */ |
||
44 | protected $plugin; |
||
45 | |||
46 | /** |
||
47 | * @var array |
||
48 | */ |
||
49 | protected $then = []; |
||
50 | |||
51 | /** |
||
52 | * @var string |
||
53 | */ |
||
54 | protected $html = ''; |
||
55 | |||
56 | /** |
||
57 | * @return $this |
||
58 | */ |
||
59 | public function toastr() |
||
67 | |||
68 | /** |
||
69 | * @return $this |
||
70 | */ |
||
71 | public function swal() |
||
79 | |||
80 | /** |
||
81 | * @return SweatAlert2 |
||
82 | */ |
||
83 | public function getPlugin() |
||
87 | |||
88 | /** |
||
89 | * @param string $message |
||
90 | * |
||
91 | * @return $this |
||
92 | */ |
||
93 | public function success(string $message = '') |
||
97 | |||
98 | /** |
||
99 | * @param string $message |
||
100 | * |
||
101 | * @return $this |
||
102 | */ |
||
103 | public function info(string $message = '') |
||
107 | |||
108 | /** |
||
109 | * @param string $message |
||
110 | * |
||
111 | * @return $this |
||
112 | */ |
||
113 | public function warning(string $message = '') |
||
117 | |||
118 | /** |
||
119 | * @param string $message |
||
120 | * |
||
121 | * @return $this |
||
122 | */ |
||
123 | public function error(string $message = '') |
||
127 | |||
128 | /** |
||
129 | * @param string $type |
||
130 | * @param string $title |
||
131 | * |
||
132 | * @return $this |
||
133 | */ |
||
134 | protected function show($type, $title = '') |
||
140 | |||
141 | /** |
||
142 | * Send a redirect response. |
||
143 | * |
||
144 | * @param string $url |
||
145 | * |
||
146 | * @return $this |
||
147 | */ |
||
148 | public function redirect(string $url) |
||
154 | |||
155 | /** |
||
156 | * Send a open new window response. |
||
157 | * |
||
158 | * @param string $url |
||
159 | */ |
||
160 | public function open(string $url) |
||
166 | |||
167 | /** |
||
168 | * Send a location redirect response. |
||
169 | * |
||
170 | * @param string $location |
||
171 | * |
||
172 | * @return $this |
||
173 | */ |
||
174 | public function location(string $location) |
||
180 | |||
181 | /** |
||
182 | * Send a download response. |
||
183 | * |
||
184 | * @param string $url |
||
185 | * |
||
186 | * @return $this |
||
187 | */ |
||
188 | public function download($url) |
||
194 | |||
195 | /** |
||
196 | * Send a refresh response. |
||
197 | * |
||
198 | * @return $this |
||
199 | */ |
||
200 | public function refresh() |
||
206 | |||
207 | /** |
||
208 | * Send a html response. |
||
209 | * |
||
210 | * @param string $html |
||
211 | * |
||
212 | * @return $this |
||
213 | */ |
||
214 | public function html($html = '') |
||
220 | |||
221 | /** |
||
222 | * @param \Exception $exception |
||
223 | * |
||
224 | * @return mixed |
||
225 | */ |
||
226 | public static function withException(\Exception $exception) |
||
240 | |||
241 | /** |
||
242 | * @return \Illuminate\Http\JsonResponse |
||
243 | */ |
||
244 | public function send() |
||
257 | |||
258 | /** |
||
259 | * @param string $method |
||
260 | * @param array $arguments |
||
261 | * |
||
262 | * @return $this |
||
263 | */ |
||
264 | public function __call($method, $arguments) |
||
274 | } |
||
275 |