ventom/flutter-api-package 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

ventom/flutter-api-package

最新稳定版本:v1.0.0

Composer 安装命令:

composer require ventom/flutter-api-package

包简介

A package to integrate API for Flutter app.

README 文档

README

Overview

The MakeFlutterCommand package provides a Laravel artisan command to generate essential files and structure for a Flutter component in a Laravel project. This command streamlines the development process by automatically creating the necessary resources, migrations, models, controllers, and routes, following Laravel's best practices.

Installation

1. Require the Package

To get started, you need to require the package in your Laravel project using Composer:

composer require ventom/make-flutter-command

2. Service Provider (If Not Auto-Discovered)

If ventom package is not auto-discovered by Laravel, you need to manually register the service provider. Open the config/app.php file and add the service provider to the providers array:

'providers' => [
    // Other Service Providers

    Vendor\Package\FlutterServiceProvider::class,
]

3. Publish Configuration (Optional)

If your package includes configuration files that need to be published to the Laravel application's config directory, you can publish them using the following command:

php artisan vendor:publish --provider="Vendor\Package\FlutterServiceProvider"

Usage

Make a Flutter Component

You can generate a Flutter component using the following artisan command:

    php artisan make:flutter {name} {--seeder}
  • {name}: The name of the component you want to create.
  • --seeder: (Optional) If this option is provided, a seeder file will also be generated.

Example

To create a Flutter component named "Product" and include a seeder, use the command:

    php artisan make:flutter Product --seeder

This command will create the following files and updates:

  1. Resource: app/Http/Resources/ProductResource.php
  2. Migration: database/migrations/xxxx_xx_xx_create_products_table.php
  3. Helper: app/Helpers/ProductHelper.php
  4. Model: app/Models/Product.php
  5. Controller: app/Http/Controllers/Api/ProductController.php
  6. Routes: Adds RESTful API routes in routes/api.php
  7. Seeder: (If --seeder is provided) database/seeders/ProductSeeder.php

Generated Controller Actions

The package creates a controller with the following actions:

  • json(): Fetches all instances of the model and returns them as a JSON response.
  • show($id): Fetches a specific instance by its ID.
  • store(Request $request): Stores a new instance in the database.
  • update(Request $request, $id): Updates an existing instance by its ID.
  • destroy($id): Deletes an instance by its ID.

Generated API Routes

The generated routes can be found in routes/api.php and include:

Route::prefix('products')
    ->controller(App\Http\Controllers\Api\ProductController::class)
    ->group(function () {
        Route::get('/json', 'json');
        Route::get('/{id}', 'show');
        Route::post('/', 'store');
        Route::put('/{id}', 'update');
        Route::delete('/{id}', 'destroy');
    });

Changelog

All notable changes to this project will be documented in this section.

Contributing

If you'd like to contribute, please fork the repository and use a feature branch. Pull requests are welcome.

License

This package is open-source software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-08-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固