File tree Expand file tree Collapse file tree 2 files changed +64
-2
lines changed Expand file tree Collapse file tree 2 files changed +64
-2
lines changed Original file line number Diff line number Diff line change @@ -42,9 +42,26 @@ Swal::question([
4242 ' title ' => ' Popup with a question icon ' ,
4343]);
4444
45- // or toast
45+ // or a toast
4646Swal::toast([
47- ' title ' => ' Laravel + SweetAlert2 = <3 ' ,
47+ ' title ' => ' Toast ' ,
48+ ]);
49+
50+ // or a toast with a custom icon
51+ Swal::toastSuccess([
52+ ' title ' => ' Toast with a success icon ' ,
53+ ]);
54+ Swal::toastError([
55+ ' title ' => ' Toast with an error icon ' ,
56+ ]);
57+ Swal::toastWarning([
58+ ' title ' => ' Toast with a warning icon ' ,
59+ ]);
60+ Swal::toastInfo([
61+ ' title ' => ' Toast with an info icon ' ,
62+ ]);
63+ Swal::toastQuestion([
64+ ' title ' => ' Toast with a question icon ' ,
4865]);
4966```
5067
Original file line number Diff line number Diff line change @@ -56,4 +56,49 @@ public static function toast(array $options = []): void
5656 ...$ options ,
5757 ]);
5858 }
59+
60+ public static function toastSuccess (array $ options = []): void
61+ {
62+ session ()->flash ('sweetalert2 ' , [
63+ 'toast ' => true ,
64+ 'icon ' => 'success ' ,
65+ ...$ options ,
66+ ]);
67+ }
68+
69+ public static function toastError (array $ options = []): void
70+ {
71+ session ()->flash ('sweetalert2 ' , [
72+ 'toast ' => true ,
73+ 'icon ' => 'error ' ,
74+ ...$ options ,
75+ ]);
76+ }
77+
78+ public static function toastWarning (array $ options = []): void
79+ {
80+ session ()->flash ('sweetalert2 ' , [
81+ 'toast ' => true ,
82+ 'icon ' => 'warning ' ,
83+ ...$ options ,
84+ ]);
85+ }
86+
87+ public static function toastInfo (array $ options = []): void
88+ {
89+ session ()->flash ('sweetalert2 ' , [
90+ 'toast ' => true ,
91+ 'icon ' => 'info ' ,
92+ ...$ options ,
93+ ]);
94+ }
95+
96+ public static function toastQuestion (array $ options = []): void
97+ {
98+ session ()->flash ('sweetalert2 ' , [
99+ 'toast ' => true ,
100+ 'icon ' => 'question ' ,
101+ ...$ options ,
102+ ]);
103+ }
59104}
You can’t perform that action at this time.
0 commit comments