Merge pull request #277 from php-flasher/dev

update livewire and inertiajs documentation
This commit is contained in:
Younes ENNAJI
2025-03-26 21:34:02 +00:00
committed by GitHub
9 changed files with 1720 additions and 1936 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
{ {
"dist/main.css": "/dist/main.f1c926c2.css", "dist/main.css": "/dist/main.0e65cac0.css",
"dist/main.js": "/dist/main.8b056786.js", "dist/main.js": "/dist/main.8b056786.js",
"dist/455.3a7b4474.css": "/dist/455.3a7b4474.css", "dist/455.3a7b4474.css": "/dist/455.3a7b4474.css",
"dist/455.095e6545.js": "/dist/455.095e6545.js", "dist/455.095e6545.js": "/dist/455.095e6545.js",
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -2,7 +2,7 @@
"entrypoints": { "entrypoints": {
"main": { "main": {
"css": [ "css": [
"/dist/main.f1c926c2.css" "/dist/main.0e65cac0.css"
], ],
"js": [ "js": [
"/dist/main.8b056786.js" "/dist/main.8b056786.js"
File diff suppressed because one or more lines are too long
+1703 -1
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -739,7 +739,7 @@ class FlashController extends Controller
public function getFlashMessages() public function getFlashMessages()
{ {
// Get all flash messages as an array // Get all flash messages as an array
$messages = flash()->render([], 'array'); $messages = flash()->render('array');
return response()->json($messages); return response()->json($messages);
} }
@@ -1,5 +1,8 @@
--- ---
layout: default permalink: /livewire/
title: Livewire
description: Learn how to add flash notifications to your Livewire application using PHPFlasher. This guide walks you through installation and usage, so you can engage your users with informative messages.
adapter: flasher
--- ---
<div class="max-w-7xl mx-auto"> <div class="max-w-7xl mx-auto">
@@ -471,9 +474,9 @@ class UserComponent extends Component
public function render() public function render()
{ {
return <<<'HTML' return <<<'HTML'
<div> &lt;div&gt;
<button wire:click="deleteUser">Delete User</button> &lt;button wire:click="deleteUser"&gt;Delete User&lt;/button&gt;
</div> &lt;/div&gt;
HTML; HTML;
} }
@@ -509,7 +512,7 @@ class UserComponent extends Component
<div class="flex space-x-1.5 mr-3"> <div class="flex space-x-1.5 mr-3">
<div class="w-2.5 h-2.5 rounded-full bg-red-500"></div> <div class="w-2.5 h-2.5 rounded-full bg-red-500"></div>
<div class="w-2.5 h-2.5 rounded-full bg-yellow-500"></div> <div class="w-2.5 h-2.5 rounded-full bg-yellow-500"></div>
<div class="w-2.5 h-2.5 rounded-full bg-green-500"></div> <div class="w-2.5 h-2.5 rounded-full bg-green-500"></div>
</div> </div>
<div class="text-white opacity-80 text-xs font-medium">PayloadStructure.php</div> <div class="text-white opacity-80 text-xs font-medium">PayloadStructure.php</div>
</div> </div>
@@ -736,12 +739,11 @@ class PublishArticle extends Component
{ {
sweetalert() sweetalert()
->option('title', 'Publish article?') ->option('title', 'Publish article?')
->option('text', 'This will make the article visible to all users')
->option('icon', 'question') ->option('icon', 'question')
->option('showCancelButton', true) ->option('showCancelButton', true)
->option('confirmButtonText', 'Yes, publish it!') ->option('confirmButtonText', 'Yes, publish it!')
->option('cancelButtonText', 'Not yet') ->option('cancelButtonText', 'Not yet')
->fire(); ->question('Are you sure you want to publish this article?');
} }
#[On('sweetalert:confirmed')] #[On('sweetalert:confirmed')]
@@ -757,12 +759,11 @@ class PublishArticle extends Component
// Second notification (after a delay) // Second notification (after a delay)
sweetalert() sweetalert()
->timer(3000) ->timer(3000)
->option('title', 'Would you like to share it?')
->option('showCancelButton', true) ->option('showCancelButton', true)
->option('confirmButtonText', 'Yes, share it!') ->option('confirmButtonText', 'Yes, share it!')
->option('cancelButtonText', 'No thanks') ->option('cancelButtonText', 'No thanks')
->option('actionType', 'share') // Custom option to identify action ->option('actionType', 'share') // Custom option to identify action
->fire(); ->question('Do you want to share this article?');
} }
#[On('sweetalert:confirmed')] #[On('sweetalert:confirmed')]
@@ -800,8 +801,8 @@ class PublishArticle extends Component
</p> </p>
<!-- Alpine.js integration --> <!-- Alpine.js integration -->
<div class="grid md:grid-cols-2 gap-6 mb-6"> <div class="mb-6">
<div class="bg-white rounded-lg p-5 border border-slate-200 shadow-sm"> <div class="bg-white rounded-lg p-5 border border-slate-200 shadow-sm mb-4">
<div class="flex items-center mb-3"> <div class="flex items-center mb-3">
<div class="w-10 h-10 rounded-full bg-blue-100 flex items-center justify-center mr-3"> <div class="w-10 h-10 rounded-full bg-blue-100 flex items-center justify-center mr-3">
<svg class="w-5 h-5 text-blue-600" fill="currentColor" viewBox="0 0 24 24"> <svg class="w-5 h-5 text-blue-600" fill="currentColor" viewBox="0 0 24 24">
-7
View File
@@ -1,7 +0,0 @@
---
permalink: /livewire/
title: Livewire
description: Learn how to add flash notifications to your Livewire application using PHPFlasher. This guide walks you through installation and usage, so you can engage your users with informative messages.
adapter: flasher
layout: livewire
---
+1 -1
View File
@@ -737,7 +737,7 @@ document.getElementById('saveForm').addEventListener('submit', function(e) {
public function getFlashMessages(): JsonResponse public function getFlashMessages(): JsonResponse
{ {
// Get all flash messages as an array // Get all flash messages as an array
$messages = flash()->render([], 'array'); $messages = flash()->render('array');
return $this->json($messages); return $this->json($messages);
}</code></pre> }</code></pre>