定制 josegus/laravel-quick-login 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

josegus/laravel-quick-login

最新稳定版本:v1.0.0

Composer 安装命令:

composer require josegus/laravel-quick-login

包简介

Quick auth & login

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A simple Laravel component that enables quick login functionality for development environments.

In short, it includes a blade component that you can include in your login view to:

  • create new users and automatically log in as the created user, with one click
  • select an existing user to log in, with one click

Installation

You can install the package via composer:

composer require josegus/laravel-quick-login

You can publish the config file with:

php artisan vendor:publish --tag="quick-login-config"

This will create the config/quick-login.php file with the following options:

return [
    'model' => \App\Models\User::class,

    'displayed_attribute' => 'email',

    'redirect_to' => env('QUICK_LOGIN_REDIRECT_TO', 'dashboard'),
];

Optionally, you can publish the views using

php artisan vendor:publish --tag="quick-login-views"

Usage

Blade Component

The package includes a Blade component that you can use in any view:

<x-josegus::quick-login-form />

The above code will use Laravel's default authentication model (App\Models\User) and guard (web).

Using a different guard

If your app uses a different guard, pass it as a parameter to the component:

<x-josegus::quick-login-form guard="customer" />

Using factory states

To create new users, the package will use the factory defined in your auth model, so make sure your auth model uses the HasFactory trait. You can pass an array of factory states that will be applied when the package creates new users:

<x-josegus::quick-login-form
    :factory-states="['isForeign', 'withCompany']"
/>

Using extra model attributes

Alternatively, you can pass an array of properties that will be applied when the package creates new users:

<x-josegus::quick-login-form
    :model-attributes="['is_foreign' => true, 'company_name' => 'Laravel']"
/>

Advanced Customization

Change the Displayed Attribute

By default, the user's email is displayed. You can change this in the configuration:

// config/quick-login.php
return [
    'displayed_attribute' => 'username',
];

Testing

composer test

License

This package is open-source software licensed under the MIT license.

Security

⚠️ Warning: This package is designed for development environments only. It is not recommended for use in production.

统计信息

  • 总下载量: 8
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-20