第三方扩展包--Blueprint

2022-12-27  本文已影响0人  hankin_h

Blueprint 通过配置文件快速完成 Laravel 数据库迁移、模型类、工厂类等组件的编排和创建:

$ composer require --dev laravel-shift/blueprint
$ php artisan blueprint:new --config
models:
    Department:
        uuid: uuid
        name: string:50
        description: longtext
        relationships:
            hasMany: Employee
    Employee:
        uuid: uuid
        full_name: string:100
        email: string:100 index
        department_id: id foreign
        job_title: string:50
        payment_type: string:20
        salary: integer unsigned nullable
        hourly_rate: integer unsigned nullable
$ php artisan blueprint:build

Created:
- database/factories/DepartmentFactory.php
- database/factories/EmployeeFactory.php
- database/migrations/2022_12_28_075857_create_departments_table.php
- database/migrations/2022_12_28_075858_create_employees_table.php
- app/Models/Department.php
- app/Models/Employee.php
$ php artisan migrate
上一篇 下一篇

猜你喜欢

热点阅读