1. Go to this page and download the library: Download laravel-enso/upgrade library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Illuminate\Support\Facades\Schema;
use LaravelEnso\Upgrade\Contracts\MigratesTable;
class AddStatusColumn implements MigratesTable
{
public function isMigrated(): bool
{
return Schema::hasColumn('orders', 'status');
}
public function migrateTable(): void
{
Schema::table('orders', function ($table) {
$table->string('status')->nullable();
});
}
}
use LaravelEnso\Upgrade\Contracts\MigratesStructure;
use LaravelEnso\Upgrade\Traits\StructureMigration;
class OrdersStructureUpgrade implements MigratesStructure
{
use StructureMigration;
protected array $permissions = [
['name' => 'orders.index', 'description' => 'List orders', 'is_default' => true],
];
protected array $roles = ['admin'];
}