nasrulhazim
12/29/2017 - 6:33 PM

Create a Blueprint class in app/Macros/Database/Schema

Create a Blueprint class in app/Macros/Database/Schema

<?php

namespace App\Macros\Database\Schema;

use Illuminate\Database\Schema\Blueprint as DefaultBlueprint;

/**
 *
 */
class Blueprint
{
    public static function registerMacros()
    {
        DefaultBlueprint::macro('hashslug', function () {
            return $this->string('hashslug')->unique()->index();
        });

        DefaultBlueprint::macro('name', function () {
            return $this->string('name');
        });

        DefaultBlueprint::macro('uniqueEmail', function () {
            return $this->string('email')->unique();
        });

        DefaultBlueprint::macro('password', function () {
            return $this->string('password');
        });
    }
}