This is probably only of use to me, but I have need of it in multiple apps so I packaged it up in case you want it too. :)
A package generator for Laravel 5. I used to use "workbench" all the time in laravel 4 and after not liking the ones I found and getting tired of copying/pasting/manipulating a bunch of files after running a CRUD generator, I decided to make a full package generator that allows me to customize the generated files and fields for the views.
From a single line on the command prompt, Motherbox will generate an entire packagist.com ready package for laravel. You can use the provided stub files or you can customize the stub files to work the way you want. You can, optionally, create (or not) any of the following files for your package :
- Composer.json file (with configurable options)
- Vendor
- Name
- Author
- Config
- Controller
- Facade
- License
- Middleware
- Migration
- Migrate (if you just want to make the file but not run it, set "migrate" to "no")
- Model
- Table
- Primary Key
- Fields
- Fillable
- Guarded
- Policy
- Requests
- Routes
- Seed
- Test
- Views (create, show/edit and index)
You can place the info for the config options you don't want to to type out in the motherbox config file. So if you make numerous packages and never need Migration files you can set your config file for migration = 'no' and never make one. If you decide, however, for one package you need a migration you can add the option of --migration=yes and it will create the file regardless. Command line options always supercede config file options.
This page is intended for installation, please check out the wiki for more information about usage. (In progress)
composer require "smarch/motherbox"
Motherbox is a Laravel atristan command but the views it generatesuses the HTML Forms package from the "Laravel Collective" for Html & Form rendering so composer will install that as well if you don't already have it installed (you probably do...or should). Once composer has installed the necessary packages for Motherbox to function you need to open your laravel config page for service providers and add Motherbox (and if necessary the Laravel Collective Html provider). To properly function you need to have both service providers referenced : HTML Forms and Motherbox.
config/app.php
/*
* Third Party Service Providers
*/
Collective\Html\HtmlServiceProvider::class, // For Motherbox to function
Smarch\Motherbox\MotherboxServiceProvider::class, // For Motherbox
Next you will need to add the Forms Facades to your config app file. Motherbox has no facade as it is only an artisan command.
config/app.php
/*
* Third Party Service Providers
*/
'Form' => Collective\Html\FormFacade::class, // required for Motherbox Forms
'HTML' => Collective\Html\HtmlFacade::class, // required for Motherbox Forms
If you wish to use the motherbox config options or customize the stub files for your own needs you will need to publish the files. From your command prompt (wherever you run your artisan commands) enter the following command php artisan vendor:publish --provider=Smarch\Motherbox\MotherboxServiceProvider. This will create the Motherbox config file and puts the stubs files in ROOT\resources\motherbox\stubs.
php artisan vendor:publish --provider=Smarch\Motherbox\MotherboxServiceProvider
I've been a DC geek for over 30 years now and all my packages have a DC Universe name. Motherbox as an entire package generator will make sense to use DC folk. 😄