PHPackages                             sain2424/laravel-generators - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. sain2424/laravel-generators

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

sain2424/laravel-generators
===========================

Extend Laravel 5's generators.

0.0.1(6y ago)017MITPHPPHP &gt;=5.4.0CI failing

Since Jun 19Pushed 6y agoCompare

[ Source](https://github.com/sain2424/Laravel-Generators)[ Packagist](https://packagist.org/packages/sain2424/laravel-generators)[ RSS](/packages/sain2424-laravel-generators/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Laravel 5 Extended Generators
=============================

[](#laravel-5-extended-generators)

Forked from

L5 includes a bunch of generators out of the box, so this package only needs to add a few things, like:

- `make:migration:schema`
- `make:migration:pivot`
- `make:seed`

*With one or two more to come.*

Usage on Laravel 5.5
--------------------

[](#usage-on-laravel-55)

### Step 1: Install Through Composer

[](#step-1-install-through-composer)

```
composer require sain2424/generators --dev

```

### Step 2: Run Artisan!

[](#step-2-run-artisan)

You're all set. Run `php artisan` from the console, and you'll see the new commands in the `make:*` namespace section.

Usage on Laravel 5.4 and 5.3
----------------------------

[](#usage-on-laravel-54-and-53)

### Step 1: Install Through Composer

[](#step-1-install-through-composer-1)

```
composer require sain2424/generators --dev

```

### Step 2: Add the Service Provider

[](#step-2-add-the-service-provider)

You'll only want to use these generators for local development, so you don't want to update the production `providers` array in `config/app.php`. Instead, add the provider in `app/Providers/AppServiceProvider.php`, like so:

```
public function register()
{
	if ($this->app->environment() == 'local') {
		$this->app->register('Laracasts\Generators\GeneratorsServiceProvider');
	}
}
```

### Step 3: Run Artisan!

[](#step-3-run-artisan)

You're all set. Run `php artisan` from the console, and you'll see the new commands in the `make:*` namespace section.

Examples
--------

[](#examples)

- [Migrations With Schema](#migrations-with-schema)
- [Pivot Tables](#pivot-tables)
- [Database Seeders](#database-seeders)

### Migrations With Schema

[](#migrations-with-schema)

```
php artisan make:migration:schema create_users_table --schema="username:string, email:string:unique"

```

Notice the format that we use, when declaring any applicable schema: a comma-separate list...

```
COLUMN_NAME:COLUMN_TYPE

```

So any of these will do:

```
username:string
body:text
age:integer
published_at:date
excerpt:text:nullable
email:string:unique:default('foo@example.com')

```

Using the schema from earlier...

```
--schema="username:string, email:string:unique"

```

...this will give you:

```
