Changeset 4b7e2d3 for database/factories


Ignore:
Timestamp:
10/23/21 04:03:46 (3 years ago)
Author:
beratkjufliju <kufliju@…>
Branches:
develop, master
Children:
b39afb5
Parents:
c6b84df
Message:

bug fixes, edited export, added fileSeeder for DB testing

Location:
database/factories
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • database/factories/DepartmentFactory.php

    rc6b84df r4b7e2d3  
    44
    55use App\Models\Department;
     6use App\Models\Folder;
    67use Carbon\Carbon;
    78use Illuminate\Database\Eloquent\Factories\Factory;
    89use Illuminate\Support\Facades\Storage;
     10use function Sodium\increment;
    911
    1012class DepartmentFactory extends Factory
     
    2426    public function definition()
    2527    {
    26         $location = $this->faker->unique()->numberBetween(1, 15);
     28        $location = $this->faker->unique()->numberBetween(10, 25);
    2729        Storage::disk('uploads')->makeDirectory('Departments/' . $location);
    2830        return [
    29             'name' => "Department" . $this->faker->unique()->firstName(),
     31            'name' => "Department" . ' ' . $this->faker->unique()->firstName(),
    3032            'code' => $location,
    3133            'location' => 'Departments' . DIRECTORY_SEPARATOR . $location,
    32             'user_id' => $this->faker->numberBetween('1', '2'),
    33             'created_at' => Carbon::now()
     34            'no_of_folders' => 0,
     35            'user_id' => "1",
     36            'created_at' => $this->faker->dateTime()
    3437        ];
    3538    }
  • database/factories/FolderFactory.php

    rc6b84df r4b7e2d3  
    66use App\Models\Folder;
    77use Carbon\Carbon;
     8use Faker\Provider\DateTime;
    89use Illuminate\Database\Eloquent\Factories\Factory;
    910use Illuminate\Support\Facades\Storage;
     
    2728
    2829        $deptId = $this->faker->numberBetween('1', '15');
     30
    2931        $deptCode = Department::find($deptId)->code;
    3032        $name = $this->faker->unique()->firstName();
     
    3335        Storage::disk('uploads')->makeDirectory($location);
    3436
    35 
    3637        return [
    3738            'arch_id' => $deptCode . "/" . $this->faker->unique()->randomNumber(),
    3839            'name' => $name,
    39             'note' => $this->faker->realText(),
     40            'note' => "This a note field",
    4041            'location' => $location,
    4142            'user_id' => $this->faker->numberBetween('1', '2'),
  • database/factories/UserFactory.php

    rc6b84df r4b7e2d3  
    2626            'name' => $this->faker->firstName(),
    2727            'surname' => $this->faker->lastName(),
    28             'username' => $this->faker->userName(),
     28            'username' => $this->faker->unique()->userName(),
    2929            'password' => $this->faker->password(),
    30             'email' => $this->faker->email(),
     30            'email' => $this->faker->unique()->email(),
    3131            'phone_number' => $this->faker->phoneNumber(),
    3232            'role_id' => $this->faker->numberBetween(1, 2),
     
    3535            'is_forgot_password' => $this->faker->boolean,
    3636            'created_by' => "1",
    37             'created_at' => Carbon::now()
     37            'created_at' => now()
    3838        ];
    3939    }
Note: See TracChangeset for help on using the changeset viewer.