1. Go to this page and download the library: Download nekoos/laravel-seed-drain 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/ */
nekoos / laravel-seed-drain example snippets
use NekoOs\LaravelSeedDrain\Support\SeedQueue;
SeedQueue::add(
\Database\Seeders\UsersSeeder::class,
\Database\Seeders\SessionSeeder::class,
);
use NekoOs\LaravelSeedDrain\Support\SeedQueue;
SeedQueue::on('core')->add(
\Database\Seeders\PermissionsSeeder::class,
\Database\Seeders\StatusesSeeder::class,
);
SeedQueue::on('demo')->add(
\Database\Seeders\DemoUsersSeeder::class,
);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use NekoOs\LaravelSeedDrain\Support\SeedQueue;
return new class extends Migration {
public function up(): void
{
Schema::create('customers', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->timestamps();
});
SeedQueue::add(\Database\Seeders\CustomersBaseSeeder::class);
SeedQueue::on('demo')->add(\Database\Seeders\DemoCustomersSeeder::class);
}
};
use NekoOs\LaravelSeedDrain\Events\SeederRunning;
Event::listen(SeederRunning::class, function (SeederRunning $event): void {
if (app()->environment('production') && str_contains($event->seeder, 'Demo')) {
$event->skip();
}
});