Changeset 4b7e2d3 for database/factories
- Timestamp:
- 10/23/21 04:03:46 (3 years ago)
- Branches:
- develop, master
- Children:
- b39afb5
- Parents:
- c6b84df
- Location:
- database/factories
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
database/factories/DepartmentFactory.php
rc6b84df r4b7e2d3 4 4 5 5 use App\Models\Department; 6 use App\Models\Folder; 6 7 use Carbon\Carbon; 7 8 use Illuminate\Database\Eloquent\Factories\Factory; 8 9 use Illuminate\Support\Facades\Storage; 10 use function Sodium\increment; 9 11 10 12 class DepartmentFactory extends Factory … … 24 26 public function definition() 25 27 { 26 $location = $this->faker->unique()->numberBetween(1 , 15);28 $location = $this->faker->unique()->numberBetween(10, 25); 27 29 Storage::disk('uploads')->makeDirectory('Departments/' . $location); 28 30 return [ 29 'name' => "Department" . $this->faker->unique()->firstName(),31 'name' => "Department" . ' ' . $this->faker->unique()->firstName(), 30 32 'code' => $location, 31 33 '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() 34 37 ]; 35 38 } -
database/factories/FolderFactory.php
rc6b84df r4b7e2d3 6 6 use App\Models\Folder; 7 7 use Carbon\Carbon; 8 use Faker\Provider\DateTime; 8 9 use Illuminate\Database\Eloquent\Factories\Factory; 9 10 use Illuminate\Support\Facades\Storage; … … 27 28 28 29 $deptId = $this->faker->numberBetween('1', '15'); 30 29 31 $deptCode = Department::find($deptId)->code; 30 32 $name = $this->faker->unique()->firstName(); … … 33 35 Storage::disk('uploads')->makeDirectory($location); 34 36 35 36 37 return [ 37 38 'arch_id' => $deptCode . "/" . $this->faker->unique()->randomNumber(), 38 39 'name' => $name, 39 'note' => $this->faker->realText(),40 'note' => "This a note field", 40 41 'location' => $location, 41 42 'user_id' => $this->faker->numberBetween('1', '2'), -
database/factories/UserFactory.php
rc6b84df r4b7e2d3 26 26 'name' => $this->faker->firstName(), 27 27 'surname' => $this->faker->lastName(), 28 'username' => $this->faker->u serName(),28 'username' => $this->faker->unique()->userName(), 29 29 'password' => $this->faker->password(), 30 'email' => $this->faker-> email(),30 'email' => $this->faker->unique()->email(), 31 31 'phone_number' => $this->faker->phoneNumber(), 32 32 'role_id' => $this->faker->numberBetween(1, 2), … … 35 35 'is_forgot_password' => $this->faker->boolean, 36 36 'created_by' => "1", 37 'created_at' => Carbon::now()37 'created_at' => now() 38 38 ]; 39 39 }
Note:
See TracChangeset
for help on using the changeset viewer.