redbastie/bootwire

Laravel + Livewire + Bootstrap 认证用户界面。

1.0.1 2020-10-05 06:41 UTC

This package is auto-updated.

Last update: 2024-09-29 05:48:58 UTC


README

此包不再维护。请考虑以下最新包:[https://github.com/redbastie/tailwire](https://github.com/redbastie/tailwire)

Bootwire

Bootwire 是已废弃的 laravel/ui 包的替代品。它使用 Laravel + Livewire + Bootstrap。只需一条命令,它就会为您的新 Laravel 应用程序设置基本的认证框架。这包括登录、注册和密码重置。

安装

通过 composer 需要

composer require redbastie/bootwire

安装此包

php artisan bootwire:install

这将创建 app/Http/Livewire 文件夹内的 Livewire 组件。所有 JS、SASS 和视图文件都创建在您的 resources 文件夹内。它还会插入认证路由、NPM 包并更新 webpack 配置文件。

自定义

您可以在组件中覆盖任何包特性方法。

例如,自定义 Register 组件

class Register extends Component
{
    use RegistersUsers;
    
    public function rules()
    {
        return [
            'name' => ['required'],
            'email' => ['required', 'email', 'unique:users'],
            'password' => ['required', 'confirmed'],
            // add your new rules here
        ];
    }

    protected function createUser($validated)
    {
        return User::create([
            'name' => $validated['name'],
            'email' => $validated['email'],
            'password' => Hash::make($validated['password']),
            // add your new fields here
        ]);
    }
}

只需查看包特性,了解哪些方法可以覆盖。

对于所有其他自定义,您可以对此包创建的任何文件进行任何更改。