PHP code example of larawire-garage / larawire-modals
1. Go to this page and download the library: Download larawire-garage/larawire-modals library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
larawire-garage / larawire-modals example snippets
// configs/larawire-modals.php
return [
'theme' => 'bootstrap',
// OR
'theme' => 'tailwind',
// ....
];
// app/Livewire/MODAL_PATH/MYMODAL.php
class MYMODAL extends ModalComponent{
public array $modal = [
'theme' => 'bootstrap',
// OR
'theme' => 'tailwind',
//...
];
}
// configs/larawire-modals.php
return [
'class_namespace' => 'App\\Livewire\\Modals',
'view_path' => resource_path('views/livewire/modals'),
// ....
];
$this->dispatch('show',id:$post->id)->to(MyModal::class);
$this->dispatch('close')->to(MyModal::class);
$this->dispatch('close')->self();
//or
$this->closeModal();
public array $modal = [
'id' => 'my-modal',
'title' => 'My Modal',
//...
];
// configs/larawire-modals.php
return [
// ...
'theme-classes' => [
'bootstrap' => [
'backdropClasses' => '',
'containerClasses' => '',
'windowClasses' => '',
'headerClasses' => '',
'headerCloseBtnClasses' => '',
'bodyClasses' => '',
'footerClasses' => '',
'footerCloseBtnClasses' => '',
],
'tailwind' => [
'backdropClasses' => '',
'containerClasses' => '',
'windowClasses' => '',
'headerClasses' => '',
'headerCloseBtnClasses' => '',
'bodyClasses' => '',
'footerClasses' => '',
'footerCloseBtnClasses' => '',
],
],
];
// app/Livewire/MODAL_PATH/MYMODAL.php
class MYMODAL extends ModalComponent{
public array $modal = [
/** available if needs to customize */
'backdropClasses' => '',
'containerClasses' => '',
'windowClasses' => '',
'headerClasses' => '',
'headerCloseBtnClasses' => '',
'bodyClasses' => '',
'footerClasses' => '',
'footerCloseBtnClasses' => '',
//...
];
}
// app/Livewire/MODAL_PATH/MYMODAL.php
class MYMODAL extends ModalComponent{
public array $modal = [
/** Only for tailwind */
'animation' => 'slide-down', // <== slide-down, scale-up
//...
];
}
php artisan vendor:publish --tag=larawire-modals-configs
php artisan make:modal MyModal
php artisan vendor:publish --tag=larawire-modals-views