viرو/CRUD

dev-master 2021-11-23 14:12 UTC

This package is auto-updated.

Last update: 2024-09-23 20:54:17 UTC


README

viro-crud 是laravel命令,可以帮助您在命令行中创建视图、模型和控制器文件。

安装

composer require viro/crud

用法

创建视图

# Create a view 'index.blade.php' in the default directory
$ php artisan crud:view index

# Create a view 'index.blade.php' in a subdirectory ('pages')
$ php artisan crud:view index --path=pages

# Create a view resources 'index, create, edit, show' in a subdirectory ('pages')
$ php artisan crud:view index --path=pages --resource

# Create a view 'index.blade.php' with extends ('layouts.main') in the default is 'layouts.app'
$ php artisan crud:view index --extends=layouts.main

# Create a view 'index.blade.php' with section ('footer') in the default is 'content'
$ php artisan crud:view index --section=footer

创建模型

# Create a model 'Post'
$ php artisan crud:model Post

# Create a model 'Post' with name table db 'products'
$ php artisan crud:model Post --table=products

# Create a model 'Post' and view 'products'
$ php artisan crud:model Post -w --viewname=products

# Create a model 'Post' with view 'products'
$ php artisan crud:model Post -w --viewname=products

# Create a model 'Post' with view 'products' and in a subdirectory 'products'
$ php artisan crud:model Post -w --viewname=products --path=products

# Create a model 'Post' and controller
$ php artisan crud:model Post -c

# Create a model 'Post', controller and view (index.blade.php)
$ php artisan crud:model Post -cw

# Create a model 'Post', controller and view resources (index, create, edit, show)
$ php artisan crud:model Post -cW

# Create a model 'Post', controller resources and view resources (index, create, edit, show)
$ php artisan crud:model Post -r

# Create a model 'Post', controller resources, view resources (index, create, edit, show) and Requests
$ php artisan crud:model Post -rR

# Create a model 'Post', controller resources, view resources (index, create, edit, show) in a subdirectory 'products' and Requests
$ php artisan crud:model Post -rR --path=products