定制 hexiros/person-trait 二次开发

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

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

hexiros/person-trait

Composer 安装命令:

composer require hexiros/person-trait

包简介

A simple package that adds Person trait to any model.

README 文档

README

This package provides a PersonTrait that can be used in Laravel models to add common personal information fields. The fields include: firstName, middleName, lastName, birthDate, birthPlace, gender, nationality, religion, suffix, salutation, and title.

Installation

You can install this package using Composer. Run the following command in your Laravel application directory:

composer require your-vendor-name/person-trait

Next, add the service provider to the providers array in your Laravel application's config/app.php file:

'providers' => [
    // Other service providers...
    Hexiros\PersonTrait\Providers\PersonServiceProvider::class,
],

Finally, run the migrations to add the Person fields to your users table:

php artisan migrate

Usage

To use the PersonTrait, simply add it to any Laravel model that should have personal information fields:

use YourVendorName\PersonTrait\PersonTrait;

class User extends Authenticatable
{
    use PersonTrait;
    
    // Your model code...
}

You can then access the Person fields on instances of the model:

$user = User::find(1);
$user->firstName = 'John';
$user->lastName = 'Doe';
$user->save();

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-10