Blame view

database/seeders/JobTitlesMainSeeder.php 1.78 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\job_titles_main;
  use Illuminate\Database\Console\Seeds\WithoutModelEvents;
  use Illuminate\Database\Eloquent\Model;
  use Illuminate\Database\Seeder;
  
  class JobTitlesMainSeeder extends Seeder
  {
      /**
       * Run the database seeds.
       *
       * @return void
       */
      public function run()
      {
          $data = [
              /*1 */[
                  'name' => 'Пункт 1',
                  'job_title_id' => '0',
                  'sort' => '100',
  
              ],
              /*2*/[
                  'name' => 'Пункт 2',
                  'job_title_id' => '0',
                  'sort' => '110',
              ],
              /*3*/[
                  'name' => 'Пункт 3',
                  'job_title_id' => '0',
                  'sort' => '120',
              ],
              /*4*/[
                  'name' => 'Пункт 4',
                  'job_title_id' => '0',
                  'sort' => '130',
              ],
              /*5*/[
                  'name' => 'Пункт 5',
                  'job_title_id' => '0',
                  'sort' => '140',
              ],
              /*6*/[
                  'name' => 'Пункт 6',
                  'job_title_id' => '0',
                  'sort' => '150',
              ],
              /*7*/[
                  'name' => 'Пункт 7',
                  'job_title_id' => '0',
                  'sort' => '160',
              ],
              /*8*/[
                  'name' => 'Пункт 8',
                  'job_title_id' => '0',
                  'sort' => '170',
              ],
          ];
  
          foreach ($data as $item) {
              $emp = new job_titles_main();
              $emp->name = $item['name'];
              $emp->job_title_id = $item['job_title_id'];
              $emp->sort = $item['sort'];
              $emp->save();
          }
      }
  }