diff --git a/app/Enums/Examples/Ui/Banner.php b/app/Enums/Examples/Ui/Banner.php index 2b716aa..51baea0 100644 --- a/app/Enums/Examples/Ui/Banner.php +++ b/app/Enums/Examples/Ui/Banner.php @@ -198,6 +198,35 @@ public function save() } HTML; + public const CONTROLLERS = <<<'HTML' + use Illuminate\Http\Request; + use TallStackUi\Traits\Interactions; + + class PaymentController extends Controller + { + use Interactions; // [tl! highlight] + + public function index() + { + return view('payment.index', [ + // + ]); + } + + public function update(Request $request) + { + // ... + + $this->banner() // [tl! highlight:5] + ->success('...') + ->close() + ->enter(seconds: 3) + ->leave(seconds: 10) + ->send(); + } + } + HTML; + public const PERSONALIZATION = <<<'HTML' TallStackUi::personalize() ->banner() diff --git a/app/Enums/Examples/Ui/Dialog.php b/app/Enums/Examples/Ui/Dialog.php index 245d872..c387800 100644 --- a/app/Enums/Examples/Ui/Dialog.php +++ b/app/Enums/Examples/Ui/Dialog.php @@ -120,6 +120,7 @@ public function save(): void // When using `success()`, `error()`, `warning()`, `info()` and pressing the OK button. 'ok' => [ 'method' => 'method', + // The parameters can be anything you want: arrays, strings, int. 'params' => ['param1', 'param2'] ], // When close the dialog by clicking on the "x" button. diff --git a/app/Enums/Examples/Ui/Toast.php b/app/Enums/Examples/Ui/Toast.php index 1c2044d..6f30297 100644 --- a/app/Enums/Examples/Ui/Toast.php +++ b/app/Enums/Examples/Ui/Toast.php @@ -157,6 +157,7 @@ public function save(): void // When close the toast by clicking on the "x" button. 'close' => [ 'method' => 'method', + // The parameters can be anything you want: arrays, strings, int. 'params' => ['param1', 'param2'] ], // When the toast is automatically closed by the timeout. diff --git a/contents/on-this-page.json b/contents/on-this-page.json index a7819f3..4d74bfd 100644 --- a/contents/on-this-page.json +++ b/contents/on-this-page.json @@ -201,7 +201,8 @@ "5": "Animations", "6": "Date Limit", "7": "Size Variations", - "8": "Color Variations & Light Option" + "8": "Color Variations & Light Option", + "9": "Dispatching via Controllers" } }, "Livewire Integration": { diff --git a/resources/views/documentation/interactions/dialog.blade.php b/resources/views/documentation/interactions/dialog.blade.php index 8231bf1..dc3391b 100644 --- a/resources/views/documentation/interactions/dialog.blade.php +++ b/resources/views/documentation/interactions/dialog.blade.php @@ -88,7 +88,7 @@

- Because certain methods were created and designed to be used with Livewire components, + Because certain methods were created and designed to be used with Livewire components, methods like confirm, cancel and hooks will be unavailable and will throw exceptions when you try to use them in controllers.

diff --git a/resources/views/documentation/interactions/toast.blade.php b/resources/views/documentation/interactions/toast.blade.php index 2e8ad2b..cf15a0d 100644 --- a/resources/views/documentation/interactions/toast.blade.php +++ b/resources/views/documentation/interactions/toast.blade.php @@ -107,7 +107,7 @@

- Because certain methods were created and designed to be used with Livewire components, + Because certain methods were created and designed to be used with Livewire components, methods like confirm, cancel and hooks will be unavailable and will throw exceptions when you try to use them in controllers.

diff --git a/resources/views/documentation/ui/banner.blade.php b/resources/views/documentation/ui/banner.blade.php index 5ac9254..55c1f27 100644 --- a/resources/views/documentation/ui/banner.blade.php +++ b/resources/views/documentation/ui/banner.blade.php @@ -53,6 +53,12 @@ + +

+ Starting from version 1.35.0 you can trigger a banner via controllers. +

+ +