定制 darshan-belani/laravel-crud-generator 二次开发

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

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

darshan-belani/laravel-crud-generator

最新稳定版本:v1.0.0

Composer 安装命令:

composer require darshan-belani/laravel-crud-generator

包简介

Laravel CRUD Generator

README 文档

README

model_1

This Laravel CRUD Generator package streamlines development by generating Migration, Controllers, Models (with Eloquent relationships), and Views using a single command. It supports multiple frontend stacks, including Bootstrap, Tailwind CSS, and Livewire (Livewire views use Tailwind CSS). You can also choose an API-only stack for backend-focused applications.

  • Will create Model with Eloquent relations
  • Will create Migration with table name anf fillable attribute
  • Will create Controller with all resources
  • Will create API Controllers with all requests
  • Will create Component with all resources for Livewire
  • Will create views in Bootstrap/Tailwind

This is the best crud generator for a blank Laravel project installation too. This will auto install the starter kit laravel/breeze or laravel/ui (for bootstrap 5) for blank Laravel installation.

Requirements

Laravel >= 10.x
PHP >= 8.1

Installation

1 - Install

composer require darshan-belani/laravel-crud-generator

2- Publish the default package's config (optional)

php artisan vendor:publish --tag=crud

Usage

When creating a blog module, please ensure that the table name is set as either blogs or posts.

php artisan make:module {table_name}

php artisan make:module posts

Enter table name

createTable.png

Tech Stack

img.png

Enter the number for how many fields required (number only)

field_number.png

Enter fields name

enter_field_name.png

After that those below files is created

create_files.png

File examples

Created a route in web.php

Route::resource('blogs', BlogController::class);

For Livewire created routes below

Route::get('/posts', \App\Livewire\Posts\Index::class)->name('posts.index');
Route::get('/posts/create', \App\Livewire\Posts\Create::class)->name('posts.create');
Route::get('/posts/show/{bank}', \App\Livewire\Posts\Show::class)->name('posts.show');
Route::get('/posts/update/{bank}', \App\Livewire\Posts\Edit::class)->name('posts.edit');

For api created routes below

Route::apiResource('blogs', BlogController::class);

Route name in plural slug case.

php artisan make:module {table_name} {bootstrap,tailwind,livewire,api}

php artisan make:module blogs bootstrap  //This will create views in Bootstrap 5 using Blade
php artisan make:module blogs tailwind   //This will create views in Tailwind css using Blade
php artisan make:module blogs livewire   //This will create views in Tailwind css with Livewire components
php artisan make:module blogs api        //This will create API only controllers

Custom Route

php artisan make:module {table_name} --route={route_name}

File Examples

Model structure

model

Controller structure

controller

Livewire component

live_wire

API only controller

api_controller

Tailwind CSS

Listing

Tailwind Form

tailwind_from

Bootstrap

Listing

Bootstrap Form

bootstrap_from

Personalize

You have the possibility of 100% customizing the generated views, this is achieved in the following way:

  • Run this command php artisan vendor:publish --tag=crud this will create the crud.php file in your config/ folder.
  • Update the variable stub_path, to your own stub folder like 'stub_path' => resource_path('stubs/'),
  • Copy the stubs files from package
php artisan vendor:publish --tag=stubs-crud
  • Update your changes in your stub files. (you can delete extra files/folders if you are not using them).
  • Run the command for crud generation and you'll get the updated views.

Author

Darshan Belani // Email Me

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-05