定制 mehadi/laravel-crud-generator 二次开发

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

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

mehadi/laravel-crud-generator

Composer 安装命令:

composer require mehadi/laravel-crud-generator

包简介

A laravel package to generate CRUD by giving Model and database table column

README 文档

README

Introduction

Welcome to the Laravel CRUD Generator 🖥️🔥! This package provides a convenient way to quickly generate CRUD (Create, Read, Update, Delete) functionality for your Laravel projects.

Installation

To integrate the Laravel CRUD Generator into your Laravel project, follow these steps:

  1. Open your terminal and navigate to your project's root directory.
  2. Run the following command to install the package via Composer:
composer require mehadi/laravel-crud-generator

Features

The Laravel CRUD Generator offers the following features:

  • Automatically creates the Model, Migration, Controller, and View files for your CRUD operations.
  • Adds a menu item to the navigation for easy access to the generated CRUD pages.
  • Sets up the necessary routes in the web.php file.
  • On deletion, it removes all the files generated by the CRUD operations.
  • Input fields [text, textarea, email, number, file]
  • File uploading
  • Deleting old file when updating any model post
  • Simple Form validation

Usage

Once you've installed the package and set up the prerequisites, you can use the Laravel CRUD Generator to quickly create CRUD operations for your models. Here's how:

  1. Open your terminal in the root directory of your Laravel project.
  2. Use the following command to generate CRUD files for a specific model (e.g., Post) along with its columns:
php artisan crud:make Post --data='title:string:input,description:text:textarea,image:text:file'
  • The first parameter (Post in this example) is the name of the model.

  • The second parameter (--data) specifies the table columns for the model, where each column is defined as column_name:data_type.

  • Certainly, let's break down secound parameter (--data='title:string:input,description:text:textarea,image:text:file'):

  • image: This is the name of the column in the database table. It represents a field in the table where you'll store information related to images.

  • text: This is the data type assigned to the column in the database. In this case, it's set to "text," which indicates that the column can store a longer text-based content.

  • file: This refers to the input type that you would use in the user interface (UI) for uploading files. In the context of HTML forms, this would be an <input> element with type="file". This allows users to select and upload files, such as images, from their devices.

  1. After creating a new Model, be sure to execute the following command:
php artisan migrate

Running this command is important to ensure that any database changes related to the new Model are properly applied. This helps keep your database schema synchronized with your application's data structure. 4. To delete all the generated CRUD files and clean up, use the following command:

php artisan crud:delete Post
  1. To make these uploaded files accessible from the web, you need to create a symbolic link from the public/storage directory to the storage/app/public directory. This can be done using the following Artisan command:
php artisan storage:link

After running this command, Laravel will create a symbolic link that allows files in the storage/app/public directory to be accessed through the URL http://your-app-url/storage.

Prerequisites

Before using the Laravel CRUD Generator, make sure you have the following prerequisites set up in your project:

  1. Install Laravel Breeze package:
composer require laravel/breeze
  1. Run the Breeze installation command and choose the Blade template option:
php artisan breeze:install
  1. Run the migration command to set up the database tables:
php artisan migrate
  1. Install npm packages:
npm install
  1. Compile the assets with the following command:
npm run dev

Screenshots

Add new Post form

View Post Modal

List Post

Add Post Modal

Notes

  • This package helps automate the process of generating CRUD operations for your Laravel models, saving you time and effort.
  • Ensure that you have all the prerequisites installed and set up correctly before using the CRUD generator.

For more information, visit the GitHub repository or the Packagist page of the package.

mehadi/laravel-crud-generator 适用场景与选型建议

mehadi/laravel-crud-generator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.53k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2023 年 08 月 24 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「crud-generator」 「laravel-crud-generator」 「laravel-auto-crud」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 mehadi/laravel-crud-generator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 mehadi/laravel-crud-generator 我们能提供哪些服务?
定制开发 / 二次开发

基于 mehadi/laravel-crud-generator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-08-24