定制 rohith016/e-commerce-stock-models 二次开发

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

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

rohith016/e-commerce-stock-models

最新稳定版本:v1.0.0

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.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-11-01