HEX
Server: LiteSpeed
System: Linux s3604.bom1.stableserver.net 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
User: dmstechonline (1480)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/dmstechonline/whatsapp.dmstech.online/database/seeders/AddonsTableSeeder5.php
<?php

namespace Database\Seeders;

use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use App\Models\Addon;

class AddonsTableSeeder5 extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $rows = [
            [
                'category' => 'two factor authentication',
                'name' => 'Google Authenticator',
                'logo' => 'google_authenticator.png',
                'description' => 'Google Authenticator enhances security with two-factor authentication.',
                'metadata' => '{"input_fields": [{"element":"toggle","type":"checkbox","name":"google_auth_active","label":"Enable\/disable Google Authenticator","class":"col-span-2"}]}',
                'license' => 'regular',
                'version' => '1.0',
                'update_available' => 0,
                'status' => 1,
            ]
        ];

        foreach ($rows as $row) {
            // Check if a record with the same name exists
            Addon::firstOrCreate(
                ['name' => $row['name']],
                $row 
            );
        }
    }
}