PHP code example of abdulmannans / seed-spotter

1. Go to this page and download the library: Download abdulmannans/seed-spotter 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/ */

    

abdulmannans / seed-spotter example snippets


use Abdulmannans\SeedSpotter\Facades\SeedSpotter;

$result = SeedSpotter::compare(YourSeederClass::class, "your_table_name");

if ($result["has_discrepancies"]) {
  foreach ($result["discrepancies"] as $discrepancy) {
    // Handle discrepancy
  }
} else {
  // Data is in sync
}

return [
  // The default table to check if not specified
  "table" => "users",

  // Columns to ignore in comparisons
  "ignore_columns" => ["created_at", "updated_at"],
];
bash
php artisan seed-spotter:compare "Database\Seeders\YourSeeder" --table=your_table_name
bash
php artisan vendor:publish --provider="Abdulmannans\SeedSpotter\SeedSpotterServiceProvider" --tag="config"