Conditions | 1 |
Paths | 1 |
Total Lines | 17 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 1 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
23 | 18 | public function boot() |
|
24 | { |
||
25 | 18 | RedirectResponse::macro('withAlert', function (string $type, string $message) { |
|
26 | /** @var \Illuminate\Http\RedirectResponse $redirectResponse */ |
||
27 | 1 | $redirectResponse = $this; |
|
28 | |||
29 | 1 | $type = 'alert-' . $type; |
|
30 | 1 | $alert = compact('type', 'message'); |
|
31 | |||
32 | 1 | return $redirectResponse->with(compact('alert')); |
|
33 | }); |
||
34 | |||
35 | 18 | RedirectResponse::macro('withAlertSuccess', function (string $message) { |
|
36 | /** @var \Illuminate\Http\RedirectResponse $redirectResponse */ |
||
37 | 1 | $redirectResponse = $this; |
|
38 | |||
39 | 1 | return $redirectResponse->withAlert('success', $message); |
|
40 | }); |
||
43 |