fredlabs/business-units
最新稳定版本:v1.0.1
Composer 安装命令:
composer require fredlabs/business-units
包简介
Business units handler for Laravel 10.* and above.
README 文档
README
FredLabs Business Units
Handle business unit within your application.
fredlabs/business-units is a Laravel package for handling business units in your application. It provides a trait and model for managing business units and includes functionality for automatically updating existing tables with a business_unit_id column.
Requirements
- Laravel 10.x or higher
- PHP 8.2 or higher
- Composer
Installation, and Usage Instructions
To install the package, use Composer:
composer require fredlabs/business-units
Publish Vendor Files
After successful installation, publish the package's configuration and migration files by running:
php artisan vendor:publish --provider="FredLabs\BusinessUnits\Providers\BusinessUnitServiceProvider"
Edit Configuration
The above command will publish customizable configuration files. In the config/business-units.php file, you can add or modify the fillable attributes in the business_units array to specify which fields you want to use for business unit parameters. For example:
return [ 'fillable' => [ 'name', 'description', 'other_field', ], ];
Migrate Tables
To apply the changes to your existing tables, including adding the business_unit_id column, run:
php artisan migrate
Usage
After installation and migration, you can use the HasBusinessUnit trait in your Eloquent models to enable business unit functionality. Here's how to use it in your models:
use FredLabs\BusinessUnits\Traits\HasBusinessUnit; class User extends Authenticatable { use HasBusinessUnit; }
This trait will allow you to associate business units with your models. Ensure to adjust your models and controllers to handle business unit logic as required.
Authors and Acknowledgments
- FredLabs: Development and maintenance of the package.
- Special thanks to the Laravel community and contributors who provide support and feedback.
License
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-24