bastinald/laravel-livewire-routes 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bastinald/laravel-livewire-routes

最新稳定版本:3.0.0

Composer 安装命令:

composer require bastinald/laravel-livewire-routes

包简介

Laravel Livewire full page component routing.

README 文档

README

This 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.

Documentation

Installation

Require the package via composer:

composer require bastinald/laravel-livewire-routes

Usage

The Route Method

Declare a route method in your full page Livewire components to route to them:

namespace App\Http\Livewire\Auth;

use Illuminate\Support\Facades\Route;
use Livewire\Component;

class Login extends Component
{
    public function route()
    {
        return Route::get('login')
            ->name('login')
            ->middleware('guest');
    }
    
    public function render()
    {
        return view('livewire.auth.login');
    }
}

As 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.

Using Route Parameters

Pass route parameters to the component mount method as usual:

namespace App\Http\Livewire\Users;

use App\Models\User;
use Illuminate\Support\Facades\Route;
use Livewire\Component;

class Update extends Component
{
    public $user;

    public function route()
    {
        return Route::get('users/update/{user}')
            ->name('users.update')
            ->middleware('auth');
    }
    
    public function mount(User $user)
    {
        $this->user = $user;
    }
    
    public function render()
    {
        return view('livewire.users.update');
    }
}

Yes, this even works with automatic model binding!

统计信息

  • 总下载量: 1.67k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 27
  • 点击次数: 1
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 27
  • Watchers: 2
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-06-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固