New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

eelcol/laravel-blueprint-group

Laravel Blueprint group extension
6,992
Install
composer require eelcol/laravel-blueprint-group
Latest Version:1.1.0
PHP:^7.3.0
Laravel:6 · 7 · 8
License:MIT
Last Updated:Feb 1, 2023
Links: GitHub  ·  Packagist
Maintainer: eelcol

Laravel Blueprint Group

Sometimes, you want to group statements in your migration files. For example, when you want to add 3 new columns to a table and don't want to specify an ->after('...') on every statement. Now you can use the group method!

Example

Lets take the following migration as example:

Schema::table('table', function (Blueprint $table) {
            
	$table->string('new_column_a')->nullable()->after('some_old_column');
	$table->string('new_column_b')->nullable()->after('new_column_a');
	$table->string('new_column_c')->nullable()->after('new_column_b');

});

This can be grouped as follows:

Schema::table('table', function (Blueprint $table) {

	$table->group(function($group) {
            
		$group->string('new_column_a');
		$group->string('new_column_b');
		$group->string('new_column_c');

	})->nullable()->after('some_old_column');

});

Installation

Require this package with composer.

composer require eelcol/laravel-blueprint-group

Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.

If you don't use auto-discovery, add the ServiceProvider to the providers array in config/app.php

Eelcol\LaravelBlueprintGroup\BlueprintGroupServiceProvider::class,

Related Packages

tomzx/laravel-migration

A migration service based on Laravel Database package.

35 5
ucan-lab/laravel-dacapo

Laravel migration support tools

423,246 110
chrishalbert/laravel-nomadic

A suite of tools to enhance robustness of laravel's migrations.

27,991 31
gguney/rmigration

Reverse Migration for Laravel

3,733 3
avto-dev/data-migrations-laravel

Package for data migrations in laravel applications

1,024 1

Version History

Version Released PHP Laravel License
1.1.0 ^7.3.0 ^6|^7|^8 MIT
1.0.3 >=7.0.0 MIT
1.0.2 >=7.0.0 MIT