lanciweb/laravel-make-crud

一个允许创建模型、迁移、填充器、视图、路由和资源控制器的Laravel包,用于CRUD操作。

安装: 985

依赖: 0

建议者: 0

安全: 0

星星: 32

关注者: 1

分支: 0

开放问题: 0

类型:laravel-package

v1.0.4 2023-03-15 07:39 UTC

This package is auto-updated.

Last update: 2024-09-15 10:45:50 UTC


README

Laravel MakeView是一个Laravel包,可以帮助您创建对模型进行CRUD操作所需的所有文件。

安装

使用composer安装Laravel MakeCrud

composer require lanciweb/laravel-make-crud

用法

默认命令

此命令没有选项,代表默认行为

php artisan make:crud Post

 # - Generates the model (Post.php)
 # - Generates a resource controller (PostController.php)
 # - Automatically imports the Post model in the controller
 # - Generates a seeder (PostSeeder.php)
 # - Generates a create table migration (create_posts_table***.php)
 # - Registers all the Resource routes in web.php for the posts
 # - Creates a view folder  (resources/views/posts)
 # - The following blade files will be created in the folder
 # ----- index.blade.php
 # ----- show.blade.php 
 # ----- create.blade.php 
 # ----- edit.blade.php

前缀

给模型名称添加前缀(例如:Admin/Post)将会产生以下差异

php artisan make:crud Admin\Post

# - The controller will be placed in the 'Admin' folder
# - Routes URIs will be prefixed with 'admin/'
# - Routes names will be prefixed with 'admin.'
# - Views will be placed in 'resources/views/admin/posts'

API选项

添加--api选项将产生以下差异

php artisan make:crud Post --api

# - The controller will be placed in the 'Api' folder
# - The controller will not have the 'create' and 'edit' methods
# - Routes will be registered in the 'api.php' file
# - Views will not be generated

选择选项

添加以下任何选项(除了--api)将阻止默认行为,让您手动选择要生成的项。

请注意,模型总是会生成

请注意,--all选项可以与--api选项一起使用。


贡献

欢迎提交pull requests。对于重大更改,请首先提交一个issue来讨论您想要进行的更改。

请确保根据需要更新测试。


许可

MIT