{"id":15016922,"url":"https://github.com/bastinald/laravel-livewire-routes","last_synced_at":"2025-04-12T10:42:12.242Z","repository":{"id":62492227,"uuid":"361620301","full_name":"bastinald/laravel-livewire-routes","owner":"bastinald","description":"Laravel Livewire full page component routing.","archived":false,"fork":false,"pushed_at":"2021-09-10T00:10:51.000Z","size":10,"stargazers_count":25,"open_issues_count":3,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-25T19:01:07.727Z","etag":null,"topics":["component","laravel","laravel-livewire","livewire","livewire-components","php","routing"],"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}},"created_at":"2021-04-26T04:46:42.000Z","updated_at":"2024-01-19T15:36:27.000Z","dependencies_parsed_at":"2022-11-02T11:16:35.603Z","dependency_job_id":null,"html_url":"https://github.com/bastinald/laravel-livewire-routes","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bastinald%2Flaravel-livewire-routes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bastinald%2Flaravel-livewire-routes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bastinald%2Flaravel-livewire-routes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bastinald%2Flaravel-livewire-routes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bastinald","download_url":"https://codeload.github.com/bastinald/laravel-livewire-routes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248557112,"owners_count":21124156,"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":["component","laravel","laravel-livewire","livewire","livewire-components","php","routing"],"created_at":"2024-09-24T19:49:34.360Z","updated_at":"2025-04-12T10:42:12.218Z","avatar_url":"https://github.com/bastinald.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel Livewire Routes\n\nThis package allows you to specify routes directly inside your full page Livewire components via a `route` method. The `route` method returns the Laravel `Route` facade, giving you complete control.\n\n## Documentation\n\n- [Installation](#installation)\n- [Usage](#usage)\n    - [The Route Method](#the-route-method)\n    - [Using Route Parameters](#using-route-parameters)\n\n## Installation\n\nRequire the package via composer:\n\n```console\ncomposer require bastinald/laravel-livewire-routes\n```\n\n## Usage\n\n### The Route Method\n\nDeclare a `route` method in your full page Livewire components to route to them:\n\n```php\nnamespace App\\Http\\Livewire\\Auth;\n\nuse Illuminate\\Support\\Facades\\Route;\nuse Livewire\\Component;\n\nclass Login extends Component\n{\n    public function route()\n    {\n        return Route::get('login')\n            -\u003ename('login')\n            -\u003emiddleware('guest');\n    }\n    \n    public function render()\n    {\n        return view('livewire.auth.login');\n    }\n}\n```\n\nAs you can see, the `route` method returns the Laravel `Route` facade, so you can specify anything you normally would in a routes file with this method.\n\n### Using Route Parameters\n\nPass route parameters to the component `mount` method as usual:\n\n```php\nnamespace App\\Http\\Livewire\\Users;\n\nuse App\\Models\\User;\nuse Illuminate\\Support\\Facades\\Route;\nuse Livewire\\Component;\n\nclass Update extends Component\n{\n    public $user;\n\n    public function route()\n    {\n        return Route::get('users/update/{user}')\n            -\u003ename('users.update')\n            -\u003emiddleware('auth');\n    }\n    \n    public function mount(User $user)\n    {\n        $this-\u003euser = $user;\n    }\n    \n    public function render()\n    {\n        return view('livewire.users.update');\n    }\n}\n```\n\nYes, this even works with automatic model binding!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbastinald%2Flaravel-livewire-routes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbastinald%2Flaravel-livewire-routes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbastinald%2Flaravel-livewire-routes/lists"}