PHP code example of ruzaik11 / laravel-seeder-tracker
1. Go to this page and download the library: Download ruzaik11/laravel-seeder-tracker 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/ */
ruzaik11 / laravel-seeder-tracker example snippets
namespace Database\Seeders;
use Ruzaik\SeederTracker\Seeders\TrackableSeeder;
use App\Models\User;
class UsersTableSeeder extends TrackableSeeder
{
protected function seedData()
{
// Your seeding logic
$users = User::factory(100)->create();
// Return metadata for tracking
return [
'users_created' => $users->count(),
'admin_users' => $users->where('is_admin', true)->count(),
];
}
}
use Ruzaik\SeederTracker\Traits\SeederHelper;
class ProductionDataSeeder extends TrackableSeeder
{
use SeederHelper;
protected function seedData()
{
// Only run in specific environments
return $this->runInEnvironments(['production', 'staging'], function () {
// Production-specific seeding logic
return ['production_data_created' => true];
});
}
}