{"id":15016876,"url":"https://github.com/bastinald/laravel-livewire-modals","last_synced_at":"2025-04-07T19:14:41.609Z","repository":{"id":40634466,"uuid":"365828851","full_name":"bastinald/laravel-livewire-modals","owner":"bastinald","description":"Dynamic Laravel Livewire Bootstrap modals.","archived":false,"fork":false,"pushed_at":"2024-05-30T04:42:34.000Z","size":18,"stargazers_count":67,"open_issues_count":6,"forks_count":32,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-31T15:19:45.851Z","etag":null,"topics":["bootstrap","component","dynamic","laravel","laravel-livewire","laravel-livewire-modals","livewire","livewire-component","modals","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bastinald.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-09T19:10:18.000Z","updated_at":"2025-02-25T00:36:10.000Z","dependencies_parsed_at":"2024-01-13T10:40:53.527Z","dependency_job_id":"60bdbf24-b7b9-4aac-aff3-2a4c6aefc006","html_url":"https://github.com/bastinald/laravel-livewire-modals","commit_stats":{"total_commits":18,"total_committers":3,"mean_commits":6.0,"dds":"0.11111111111111116","last_synced_commit":"fd53779095ff15d201a2adabdfbde4d101b13d59"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bastinald%2Flaravel-livewire-modals","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bastinald%2Flaravel-livewire-modals/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bastinald%2Flaravel-livewire-modals/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bastinald%2Flaravel-livewire-modals/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bastinald","download_url":"https://codeload.github.com/bastinald/laravel-livewire-modals/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247713258,"owners_count":20983683,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bootstrap","component","dynamic","laravel","laravel-livewire","laravel-livewire-modals","livewire","livewire-component","modals","php"],"created_at":"2024-09-24T19:49:30.623Z","updated_at":"2025-04-07T19:14:41.579Z","avatar_url":"https://github.com/bastinald.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel Livewire Modals\n\nThis package allows you to dynamically show your Laravel Livewire components inside Bootstrap modals.\n\n## Documentation\n\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Usage](#usage)\n    - [Modal Views](#modal-views)\n    - [Showing Modals](#showing-modals)\n    - [Mount Parameters](#mount-parameters)\n    - [Hiding Modals](#hiding-modals)\n    - [Emitting Events](#emitting-events)\n- [Publishing Assets](#publishing-assets)\n    - [Custom View](#custom-view)\n\n## Requirements\n\n- Bootstrap 5 must be installed via webpack first\n\n## Installation\n\nRequire the package:\n\n```console\ncomposer require bastinald/laravel-livewire-modals\n```\n\nAdd the `livewire:modals` component to your app layout view:\n\n```html\n\u003clivewire:modals/\u003e\n\u003clivewire:scripts/\u003e\n\u003cscript src=\"{{ asset('js/app.js') }}\"\u003e\u003c/script\u003e\n```\n\nRequire `../../vendor/bastinald/laravel-livewire-modals/resources/js/modals` in your app javascript file:\n\n```javascript\nrequire('@popperjs/core');\nrequire('bootstrap');\nrequire('../../vendor/bastinald/laravel-livewire-modals/resources/js/modals');\n```\n\n## Usage\n\n### Modal Views\n\nMake a Livewire component you want to show as a modal. The view for this component must use the Bootstrap `modal-dialog` container:\n\n```html\n\u003cdiv class=\"modal-dialog\"\u003e\n    \u003cdiv class=\"modal-content\"\u003e\n        \u003cdiv class=\"modal-header\"\u003e\n            \u003ch5 class=\"modal-title\"\u003eModal title\u003c/h5\u003e\n            \u003cbutton type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\" aria-label=\"Close\"\u003e\u003c/button\u003e\n        \u003c/div\u003e\n        \u003cdiv class=\"modal-body\"\u003e\n            \u003cp\u003eModal body text goes here.\u003c/p\u003e\n        \u003c/div\u003e\n        \u003cdiv class=\"modal-footer\"\u003e\n            \u003cbutton type=\"button\" class=\"btn btn-secondary\" data-bs-dismiss=\"modal\"\u003eClose\u003c/button\u003e\n            \u003cbutton type=\"button\" class=\"btn btn-primary\"\u003eSave changes\u003c/button\u003e\n        \u003c/div\u003e\n    \u003c/div\u003e\n\u003c/div\u003e\n```\n\n### Showing Modals\n\nShow a modal by emitting the `showModal` event with the component alias:\n\n```html\n\u003cbutton type=\"button\" wire:click=\"$emit('showModal', 'auth.profile-update')\"\u003e\n    {{ __('Update Profile') }}\n\u003c/button\u003e\n```\n\n### Mount Parameters\n\nPass parameters to the component `mount` method after the alias:\n\n```html\n\u003cbutton type=\"button\" wire:click=\"$emit('showModal', 'users.update', '{{ $user-\u003eid }}')\"\u003e\n    {{ __('Update User #' . $user-\u003eid) }}\n\u003c/button\u003e\n```\n\nThe component `mount` method for the example above would look like this: \n\n```php\nnamespace App\\Http\\Livewire\\Users;\n\nuse App\\Models\\User;\nuse Livewire\\Component;\n\nclass Update extends Component\n{\n    public $user;\n    \n    public function mount(User $user)\n    {\n        $this-\u003euser = $user;\n    }\n    \n    public function render()\n    {\n        return view('users.update');\n    }\n}\n```\n\n### Hiding Modals\n\nHide the currently open modal by emitting the `hideModal` event:\n\n```html\n\u003cbutton type=\"button\" wire:click=\"$emit('hideModal')\"\u003e\n    {{ __('Close') }}\n\u003c/button\u003e\n```\n\nOr by using the Bootstrap `data-bs-dismiss` attribute:\n\n```html\n\u003cbutton type=\"button\" data-bs-dismiss=\"modal\"\u003e\n    {{ __('Close') }}\n\u003c/button\u003e\n```\n\n### Emitting Events\n\nYou can emit events inside your views:\n\n```html\n\u003cbutton type=\"button\" wire:click=\"$emit('hideModal')\"\u003e\n    {{ __('Close') }}\n\u003c/button\u003e\n```\n\nOr inside your components, just like any normal Livewire event:\n\n```php\npublic function save()\n{\n    $this-\u003evalidate();\n\n    // save the record\n\n    $this-\u003eemit('hideModal');\n}\n```\n\n## Publishing Assets\n\n### Custom View\n\nUse your own modals view by publishing the package view:\n\n```console\nphp artisan vendor:publish --tag=laravel-livewire-modals:views\n```\n\nNow edit the view file inside `resources/views/vendor/laravel-livewire-modals`. The package will use this view to render the component.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbastinald%2Flaravel-livewire-modals","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbastinald%2Flaravel-livewire-modals","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbastinald%2Flaravel-livewire-modals/lists"}