MINI MINI MANI MO

Path : /var/www/html/sistemas/saplxi/database/seeders/
File Upload :
Current File : /var/www/html/sistemas/saplxi/database/seeders/DecretosSeeder.php

<?php

namespace Database\Seeders;

use App\Models\CddIniciativas;
use App\Models\Decretos;
use Illuminate\Database\Seeder;

class DecretosSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $iniciativa = CddIniciativas::where('categoria','Iniciativa')->get();

        foreach ($iniciativa as $item){
            if($item->decreto ){
                $decreto = Decretos::create([
                    "num_decreto" =>    $item->num_decreto == null ? " " : $item->num_decreto,
                    "fecha_decreto" =>  $item->fecha_decreto == null ? " " : $item->fecha_decreto,
                    "nombre_decreto" => $item->nombre_decreto == null ? " " : $item->nombre_decreto,
                    "decreto" =>        $item->decreto == null ? " " : $item->decreto,
                    "id_iniciativa" =>  $item->id,
                ]);
            }

        }
    }
}

OHA YOOOO