rohith016/e-commerce-stock-models
Composer 安装命令:
composer require rohith016/e-commerce-stock-models
包简介
e-commerce package for stock management and stock allocation
README 文档
README
A reusable Laravel package providing models, migrations, seeders, and factories for e-commerce applications. This package simplifies setup and accelerates development for common e-commerce functionality.
Features
Predefined Eloquent models for Product, Order, Address, and more. Migration files to create necessary database tables. Seeders and factories to populate tables with dummy data for testing and development.
Installation
Step 1: Require the Package
Install the package via Composer:
composer require rohith016/e-commerce-stock-models composer require rohith016/e-commerce-stock-models:dev-main --dev composer require rohith016/e-commerce-stock-models:^1.0
Step 2: Publish Resources
The package provides a range of resources (models, migrations, seeders, and factories). You can selectively publish resources using tags.
Step 3: Publish the Service Provider
After requiring the package, Laravel should automatically discover the service provider. If not, register it in config/app.php:
'providers' => [ // Other Service Providers Rohith\EcommercePackage\EcommerceServiceProvider::class, ];
Usage
The package resources can be published to your Laravel application’s default structure as needed.
Publish All Resources
To publish all available resources (models, migrations, seeders, and factories), run:
php artisan vendor:publish --provider="Rohith\EcommercePackage\EcommerceServiceProvider"
Selective Publishing
Use the following commands to publish specific resources:
Publish Models:
php artisan vendor:publish --tag=ecommerce-models
Publish Migrations:
php artisan vendor:publish --tag=ecommerce-migrations
Publish Seeders:
php artisan vendor:publish --tag=ecommerce-seeders
Publish Factories:
php artisan vendor:publish --tag=ecommerce-factories
Example Models and Structure
Once published, you can find the models in app/Models, migrations in database/migrations, seeders in database/seeders, and factories in database/factories.
Running Migrations and Seeders
Migrate the Database:
Run the migrations to create the e-commerce tables:
php artisan migrate Seed the Database (optional):
Seed the database tables with sample data:
php artisan db:seed --class=ProductSeeder
Example Here’s how to use the Product model:
use App\Models\Product; // Retrieve all products $products = Product::all(); // Create a new product $product = Product::create([ 'name' => 'Sample Product', 'description' => 'This is a sample product description.', 'price' => 19.99, 'stock' => 50, ]);
Contributing
Contributions are welcome! Feel free to submit a pull request or open an issue for suggestions and improvements.
License
This package is open-source software licensed under the MIT license.
rohith016/e-commerce-stock-models 适用场景与选型建议
rohith016/e-commerce-stock-models 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 11 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 rohith016/e-commerce-stock-models 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 rohith016/e-commerce-stock-models 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-11-01