Blame view

database/seeders/EmployersMainSeeder.php 1.69 KB
486a3601d   Андрей Ларионов   Должности и работ...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
  <?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();
          }
      }
  }