定制 mdarmancse/autolara 二次开发

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

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

mdarmancse/autolara

最新稳定版本:v3.0.2

Composer 安装命令:

composer require mdarmancse/autolara

包简介

Auto CRUD generation with Repository Pattern

README 文档

README

AutoLara is a Laravel package that automatically generates CRUD operations, including models, migrations, controllers, repositories, and routes based on a simple Artisan command.

Features

  • 🔹 Generates Model, Migration, Controller, Repository, and Form Requests.
  • 🔹 Updates Routes automatically.
  • 🔹 Runs migration after generation.
  • 🔹 Uses stub templates for customization.

Installation

Run the following command to install AutoLara:

composer require mdarmancse/autolara

Usage

Run the following command to generate CRUD for a model with specified fields:

php artisan autolara:crud ModelName field1:type field2:type ...

Example:

php artisan autolara:crud Product name:string price:integer is_active:boolean

Expected Output:

🔄 Generating CRUD for: Product
✅ Model created: Product
✅ Migration created: products
✅ Repository for Product generated.
✅ Controller created: ProductController
✅ Form request for Product generated.
✅ Routes for Product updated.
⚡ Running Migration...
✅ Migration successful.

Stubs Customization

You can customize the stub templates by copying them to resources/stubs/:

mkdir -p resources/stubs
cp -r vendor/mdarmancse/autolara/stubs resources/stubs

Then modify the stub files inside resources/stubs/ to fit your project requirements.

Available Field Types

The package supports the following field types:

  • string
  • integer
  • boolean
  • text
  • date
  • datetime
  • float
  • double

Troubleshooting

1. Stub File Not Found Error

If you encounter this error:

❌ Error: Stub file not found: vendor/mdarmancse/autolara/stubs/model.stub

Try running:

php artisan config:clear && php artisan cache:clear

If the issue persists, ensure that the stub files exist in the vendor/mdarmancse/autolara/stubs/ directory.

2. Migration File Not Found Error

If you see:

❌ Error: File does not exist at path database/migrations/xxxx_xx_xx_xxxxxx_create_products_table.php

Manually run:

php artisan migrate

🚀 Happy Coding!

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-02-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固