1. Go to this page and download the library: Download crazyfd/php-migrations 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 Eloquent\Migrations\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('users');
}
};
$this->schema()->create('users', function (Blueprint $table) { /* ... */ });
namespace Database\Seeders;
use Eloquent\Migrations\Seeds\Seeder;
class UsersTableSeeder extends Seeder
{
public function run(): void
{
$this->table('users')->insert([
['name' => 'alice', 'email' => '[email protected]'],
]);
}
}