Changeset e6c1f87 for database


Ignore:
Timestamp:
10/18/21 19:54:18 (3 years ago)
Author:
beratkjufliju <kufliju@…>
Branches:
develop, master
Children:
b9c4a92
Parents:
bd9e8e3
Message:

added pagination, is_important

Location:
database
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • database/factories/DepartmentFactory.php

    rbd9e8e3 re6c1f87  
    2424    public function definition()
    2525    {
    26         $location = $this->faker->unique()->numberBetween(1, 99);
     26        $location = $this->faker->unique()->numberBetween(1, 25);
    2727        Storage::disk('local')->makeDirectory('Departments/' . $location);
    2828        return [
    29             'id' => $this->faker->unique()->randomNumber(),
    30             'name' => $this->faker->name(),
     29            'name' => $this->faker->firstName() . " department",
    3130            'code' => $location,
    32             'location' => 'Departments/' . $location,
     31            'location' => Storage::disk('local')->path('') . 'Departments/' . $location,
    3332            'user_id' => $this->faker->numberBetween('1', '2'),
    3433            'created_at' => Carbon::now()
  • database/migrations/2021_10_06_103305_create_documents_table.php

    rbd9e8e3 re6c1f87  
    1919            $table->string("name");
    2020            $table->text("description");
    21             $table->boolean("is_active")->default(false);
    2221            $table->integer("user_id")->unsigned();
    2322            $table->integer("department_id")->unsigned();
     23            $table->boolean("is_important")->default(true);
    2424            $table->timestamps();
    2525
  • database/seeders/DatabaseSeeder.php

    rbd9e8e3 re6c1f87  
    1919        $this->call(UsersTableSeeder::class);
    2020        $this->call(DepartmentsTableSeeder::class);
    21         //$this->call(DocumentsTableSeeder::class);
     21        $this->call(DocumentsTableSeeder::class);
    2222    }
    2323}
  • database/seeders/DepartmentsTableSeeder.php

    rbd9e8e3 re6c1f87  
    1616    public function run()
    1717    {
    18         Department::factory()->count(99)->create();
     18        Department::factory()->count(25)->create();
    1919    }
    2020}
  • database/seeders/DocumentsTableSeeder.php

    rbd9e8e3 re6c1f87  
    33namespace Database\Seeders;
    44
     5use App\Models\Document;
    56use Carbon\Carbon;
    67use Illuminate\Database\Seeder;
     
    1516    public function run()
    1617    {
    17         \DB::table('documents')->insert([
    18             [
    19                 "name" => "Document test",
    20                 "arch_id" => "HR150",
    21                 "description" => "hahahah ah aha hshdash dhawud hwa",
    22                 "user_id" => "1",
    23                 "department_id" => "1",
    24                 "is_active" => "1",
    25                 "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
    26             ],
    27             [
    28                 "name" => "Document tests",
    29                 "arch_id" => "HR1505",
    30                 "description" => "hahahah ah aha hshdash dhawud hwa",
    31                 "user_id" => "1",
    32                 "department_id" => "2",
    33                 "is_active" => "1",
    34                 "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
    35             ],
    36             [
    37                 "name" => "Document test",
    38                 "arch_id" => "HR15033",
    39                 "description" => "hahahah ah aha hshdash dhawud hwa",
    40                 "user_id" => "1",
    41                 "department_id" => "1",
    42                 "is_active" => "1",
    43                 "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
    44             ],
    45             [
    46                 "name" => "Document testasd",
    47                 "arch_id" => "HR150124",
    48                 "description" => "hahahah ah aha hshdash dhawud hwa",
    49                 "user_id" => "1",
    50                 "department_id" => "3",
    51                 "is_active" => "1",
    52                 "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
    53             ],
    54             [
    55                 "name" => "Document test",
    56                 "arch_id" => "HR1501421",
    57                 "description" => "hahahah ah aha hshdash dhawud hwa",
    58                 "user_id" => "1",
    59                 "department_id" => "1",
    60                 "is_active" => "1",
    61                 "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
    62             ],
    63             [
    64                 "name" => "Document test",
    65                 "arch_id" => "HR150213",
    66                 "description" => "hahahah ah aha hshdash dhawud hwa",
    67                 "user_id" => "1",
    68                 "department_id" => "1",
    69                 "is_active" => "1",
    70                 "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
    71             ],
    72             [
    73                 "name" => "Document test",
    74                 "arch_id" => "HR150ad",
    75                 "description" => "hahahah ah aha hshdash dhawud hwa",
    76                 "user_id" => "1",
    77                 "department_id" => "2",
    78                 "is_active" => "1",
    79                 "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
    80             ],
    81             [
    82                 "name" => "Document test",
    83                 "arch_id" => "HR150234",
    84                 "description" => "hahahah ah aha hshdash dhawud hwa",
    85                 "user_id" => "1",
    86                 "department_id" => "3",
    87                 "is_active" => "1",
    88                 "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
    89             ],
    90             [
    91                 "name" => "Document test",
    92                 "arch_id" => "HR15012321",
    93                 "description" => "hahahah ah aha hshdash dhawud hwa",
    94                 "user_id" => "1",
    95                 "department_id" => "1",
    96                 "is_active" => "1",
    97                 "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
    98             ],
    99             [
    100                 "name" => "Document test",
    101                 "arch_id" => "HR15021312",
    102                 "description" => "hahahah ah aha hshdash dhawud hwa",
    103                 "user_id" => "1",
    104                 "department_id" => "1",
    105                 "is_active" => "1",
    106                 "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
    107             ],
    108             [
    109                 "name" => "Document test",
    110                 "arch_id" => "HR15312430",
    111                 "description" => "hahahah ah aha hshdash dhawud hwa",
    112                 "user_id" => "1",
    113                 "department_id" => "1",
    114                 "is_active" => "1",
    115                 "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
    116             ],
    117         ]);
     18//        \DB::table('documents')->insert([
     19//            [
     20//                "name" => "Document test",
     21//                "arch_id" => "HR150",
     22//                "description" => "hahahah ah aha hshdash dhawud hwa",
     23//                "user_id" => "1",
     24//                "department_id" => "1",
     25//                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
     26//            ],
     27//            [
     28//                "name" => "Document tests",
     29//                "arch_id" => "HR1505",
     30//                "description" => "hahahah ah aha hshdash dhawud hwa",
     31//                "user_id" => "1",
     32//                "department_id" => "2",
     33//                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
     34//            ],
     35//            [
     36//                "name" => "Document test",
     37//                "arch_id" => "HR15033",
     38//                "description" => "hahahah ah aha hshdash dhawud hwa",
     39//                "user_id" => "1",
     40//                "department_id" => "1",
     41//                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
     42//            ],
     43//            [
     44//                "name" => "Document testasd",
     45//                "arch_id" => "HR150124",
     46//                "description" => "hahahah ah aha hshdash dhawud hwa",
     47//                "user_id" => "1",
     48//                "department_id" => "3",
     49//                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
     50//            ],
     51//            [
     52//                "name" => "Document test",
     53//                "arch_id" => "HR1501421",
     54//                "description" => "hahahah ah aha hshdash dhawud hwa",
     55//                "user_id" => "1",
     56//                "department_id" => "1",
     57//                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
     58//            ],
     59//            [
     60//                "name" => "Document test",
     61//                "arch_id" => "HR150213",
     62//                "description" => "hahahah ah aha hshdash dhawud hwa",
     63//                "user_id" => "1",
     64//                "department_id" => "1",
     65//                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
     66//            ],
     67//            [
     68//                "name" => "Document test",
     69//                "arch_id" => "HR150ad",
     70//                "description" => "hahahah ah aha hshdash dhawud hwa",
     71//                "user_id" => "1",
     72//                "department_id" => "2",
     73//                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
     74//            ],
     75//            [
     76//                "name" => "Document test",
     77//                "arch_id" => "HR150234",
     78//                "description" => "hahahah ah aha hshdash dhawud hwa",
     79//                "user_id" => "1",
     80//                "department_id" => "3",
     81//                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
     82//            ],
     83//            [
     84//                "name" => "Document test",
     85//                "arch_id" => "HR15012321",
     86//                "description" => "hahahah ah aha hshdash dhawud hwa",
     87//                "user_id" => "1",
     88//                "department_id" => "1",
     89//                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
     90//            ],
     91//            [
     92//                "name" => "Document test",
     93//                "arch_id" => "HR15021312",
     94//                "description" => "hahahah ah aha hshdash dhawud hwa",
     95//                "user_id" => "1",
     96//                "department_id" => "1",
     97//                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
     98//            ],
     99//            [
     100//                "name" => "Document test",
     101//                "arch_id" => "HR15312430",
     102//                "description" => "hahahah ah aha hshdash dhawud hwa",
     103//                "user_id" => "1",
     104//                "department_id" => "1",
     105//                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
     106//            ],
     107//        ]);
     108        Document::factory()->count(300)->create();
    118109    }
    119110}
Note: See TracChangeset for help on using the changeset viewer.