Changeset ea7b12a for database


Ignore:
Timestamp:
10/19/21 17:46:21 (3 years ago)
Author:
beratkjufliju <kufliju@…>
Branches:
develop, master
Children:
6b95845
Parents:
b9c4a92
Message:

added files crud in table

Location:
database
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • database/factories/DepartmentFactory.php

    rb9c4a92 rea7b12a  
    2424    public function definition()
    2525    {
    26         $location = $this->faker->randomNumber('1', '1');
     26        $location = $this->faker->unique()->numberBetween('1', '9');
    2727        Storage::disk('local')->makeDirectory('Departments/' . $location);
    2828        return [
  • database/factories/DocumentFactory.php

    rb9c4a92 rea7b12a  
    2626    {
    2727
    28         $deptID = "1";
     28        $deptID = "5";
    2929        $name = $this->faker->unique()->firstName();
    3030        Storage::disk('local')->makeDirectory('Departments' . DIRECTORY_SEPARATOR . $deptID . DIRECTORY_SEPARATOR . $name);
  • database/migrations/2021_10_10_103309_create_files_table.php

    rb9c4a92 rea7b12a  
    1616        Schema::create('files', function (Blueprint $table) {
    1717            $table->bigIncrements('id');
    18             $table->bigInteger('document_id')->unsigned()->nullable();
    19             $table->string("link");
     18            $table->bigInteger('document_id')->unsigned();
     19            $table->string("name");
     20            $table->string("location");
    2021            $table->foreign("document_id")->references("id")->on("documents");
    2122            $table->timestamps();
  • database/seeders/DatabaseSeeder.php

    rb9c4a92 rea7b12a  
    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

    rb9c4a92 rea7b12a  
    1616    public function run()
    1717    {
    18         Department::factory()->count(10)->create();
     18        Department::factory()->count(8)->create();
    1919    }
    2020}
  • database/seeders/DocumentsTableSeeder.php

    rb9c4a92 rea7b12a  
    106106//            ],
    107107//        ]);
    108         Document::factory()->count(300)->create();
     108        Document::factory()->count(10)->create();
    109109    }
    110110}
Note: See TracChangeset for help on using the changeset viewer.