From 02196a86d4e48b8faf0441ea3486808d67702134 Mon Sep 17 00:00:00 2001 From: simon Date: Mon, 26 Dec 2022 12:39:41 -0300 Subject: [PATCH] [UPDATE] add alter method --- src/Migration/Schematics.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/Migration/Schematics.php b/src/Migration/Schematics.php index a0029f0..ce7af1d 100644 --- a/src/Migration/Schematics.php +++ b/src/Migration/Schematics.php @@ -3,21 +3,28 @@ namespace Larangular\MigrationPackage\Migration; use Illuminate\Database\Schema\Blueprint; -use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Schema; trait Schematics { public function create(\Closure $callback): void { Schema::connection($this->connection) - ->create($this->name, function(Blueprint $table) use ($callback) - { - $callback($table); - }); + ->create($this->name, function (Blueprint $table) use ($callback) { + $callback($table); + }); + } + + public function alter(\Closure $callback): void { + Schema::connection($this->connection) + ->table($this->name, function (Blueprint $table) use ($callback) { + $callback($table); + }); } public function drop(): void { - Schema::connection($this->connection)->drop($this->name); + Schema::connection($this->connection) + ->drop($this->name); } public function jsonableColumnType(): string {