sethios/laravel-tools 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

sethios/laravel-tools

Composer 安装命令:

composer require sethios/laravel-tools

包简介

Several tools for Laravel development

README 文档

README

A set of tools for generating basic Laravel scaffolding (including Model, Controller, View, Seeders, Migrations...).

It also includes a tool for database reseeding via Factories and/or CSV file.

Installation:

Require the package with composer:

composer require --dev sethios/laravel-tools

After installation run this command for the DB reseed function to work:

php artisan vendor:publish --tag=config

The generated config file includes basic User model configuration. You can add any other model.

Database reseed

Reseed a table (or tables) with php artisan by running:

php artisan db:reseed user

Parameters

  • "reset" -> (optional) name of migration file, used if you wish to re-migrate
  • "tables" -> array of database table names you wish to reset when running a db:reseed
  • "class" -> name od model seeder class ex. UserSeeder

Create MVC

Generate scaffolding for a model by running:

php artisan create:mvc user

The default command will generate the following files:app/Models/User.php

app/Http/Requests/UserRequest.php
app/Http/Controllers/UserController.php
app/Events/UserEvent.php
app/Listeners/UserDeleted.php
app/Listeners/UserStored.php
app/Listeners/UserUpdated.php
app/Observers/UserObserver.php
database/migrations/2021_02_05_105447_create_users_table.php
database/factories/UserFactory.php
database/seeds/UserSeeder.php
resources/lang/en/user.php
resources/js/includes/user.js
resources/views/user/index.blade.php
resources/views/user/new.blade.php
resources/views/user/edit.blade.php
resources/views/user/partials/form.blade.php
resources/views/user/partials/userListItem.blade.php
resources/views/user/partials/actions.blade.php
resources/views/user/partials/inputs.blade.php

It will also try and modify these files by searching for the commented line "Create mvc" used as a placeholder: [^1]

routes/web.php
resources/views/layouts/partials/sidebar.blade.php
app/Providers/AppServiceProvider.php
app/Providers/EventServiceProvider.php
database/seeds/DatabaseSeeder.php
resources/js/app.js

Options

There are several flags that can be used that reduce the amount of files generated i.e. specify which files you want to generate:

--m : Include Model, migration
--c : Include Controller and route
--b : Include Blade, CSS, JS files and route
--s : Include Seeder and Factory
--l : Include logic in AppServiceProvider, Events, Listeners and Observers

To Do

  • Remove the need for commented placeholders in files that need to be modified [^1]
  • Include a JSON and/or config file to pre-setup a models generation i.e. pre-define models attributes / database columns. Make it so it also generates the code for Seeders and Factories
  • Automated model relations via pre-defined attributes configuration

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-01-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固