naranarethiya/model-resource-generator 问题修复 & 功能扩展

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

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

naranarethiya/model-resource-generator

最新稳定版本:0.0.3

Composer 安装命令:

composer require naranarethiya/model-resource-generator

包简介

Automatically generate API resource classes for your Laravel models, simplifying the process of transforming your models into API resources with ease.

README 文档

README

model-resource-generator is a custom Laravel command that generates API resource classes for all available models in your Laravel application. It includes the existing columns and relations of each model in the generated resource classes.

It respects your model's hidden attributes and does not load any relations automatically. It adjusts the API attributes based on whether relations are loaded or not.

Installation

You can install the package via composer:

composer require naranarethiya/model-resource-generator

Usage

To generate API resources for models located in the app/Models directory:

php artisan generate:api-resources

To specify a different directory or a single model file:

php artisan generate:api-resources --model-path=app/CustomModels

Options

--model-path (optional): Specify the directory path to search for models or a single model file path. If not provided, it defaults to app/Models

Features

  • Automatically generates API resource classes for each model found in the specified directory.
  • Includes existing columns and relations in the generated resource classes.
  • Exclude all hidden attributes
  • Provides an option to overwrite existing resources or skip them.
  • Outputs a summary of the generated, skipped, and overwritten resources.

Contributing

Contributions are welcome! Please submit a pull request or open an issue to suggest changes or report problems.

License

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

统计信息

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

GitHub 信息

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

其他信息

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