EmployersMainSeeder.php 1.69 KB
<?php

namespace Database\Seeders;

use App\Models\employers_main;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Seeder;

class EmployersMainSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $data = [
        /*1 */[
            'name' => 'Пункт 1',
            'employer_id' => '0',
            'sort' => '100',

        ],
        /*2*/[
                'name' => 'Пункт 2',
                'employer_id' => '0',
                'sort' => '110',
        ],
        /*3*/[
                'name' => 'Пункт 3',
                'employer_id' => '0',
                'sort' => '120',
        ],
        /*4*/[
                'name' => 'Пункт 4',
                'employer_id' => '0',
                'sort' => '130',
        ],
        /*5*/[
                'name' => 'Пункт 5',
                'employer_id' => '0',
                'sort' => '140',
        ],
        /*6*/[
                'name' => 'Пункт 6',
                'employer_id' => '0',
                'sort' => '150',
        ],
        /*7*/[
                'name' => 'Пункт 7',
                'employer_id' => '0',
                'sort' => '160',
        ],
        /*8*/[
                'name' => 'Пункт 8',
                'employer_id' => '0',
                'sort' => '170',
        ],
    ];

        foreach ($data as $item) {
            $emp = new employers_main();
            $emp->name = $item['name'];
            $emp->employer_id = $item['employer_id'];
            $emp->sort = $item['sort'];
            $emp->save();
        }
    }
}