<?php


namespace App\Helpers\DatabaseSchema;

use Illuminate\Database\Schema\Builder;
use Illuminate\Support\Facades\Facade;
use Illuminate\Support\Facades\Schema as BaseSchema;

class Schema extends BaseSchema{
//class Schema extends Facade{

    protected static $cached = true;

    /**
     * Get a schema builder instance for a connection. (pas important)
     *
     * @param  string|null  $name
     * @return Builder
     */
    public static function connection($name): Builder {
        /** @var Builder $builder */
         $builder =  static::$app['db']->connection($name)->getSchemaBuilder();

        $builder->blueprintResolver(static function($table, $callback) {
            return new CustomBluePrint($table, $callback);
        });

        return $builder;
    }

}
