- Timestamp:
- 10/15/21 00:21:44 (3 years ago)
- Branches:
- develop, master
- Children:
- d795fa6
- Parents:
- 24a616f
- Location:
- database
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
database/factories/DepartmentFactory.php
r24a616f r120759b 4 4 5 5 use App\Models\Department; 6 use Carbon\Carbon; 6 7 use Illuminate\Database\Eloquent\Factories\Factory; 8 use Illuminate\Support\Facades\Storage; 7 9 8 10 class DepartmentFactory extends Factory … … 22 24 public function definition() 23 25 { 26 $location = $this->faker->unique()->numberBetween(1, 99); 27 Storage::disk('local')->makeDirectory('Departments/' . $location); 24 28 return [ 25 'name' => $this->faker->name(), 26 'code' => $this->faker->unique()->numerify(), 27 'location' => $this->faker->unique()->name(), 28 'user_id' => "1", 29 'id' => $this->faker->unique()->randomNumber(), 30 'name' => $this->faker->domainName(), 31 'code' => $location, 32 'location' => 'Departments/' . $location, 33 'user_id' => $this->faker->numberBetween('1', '2'), 34 'created_at' => Carbon::now() 29 35 ]; 30 36 } -
database/seeders/DatabaseSeeder.php
r24a616f r120759b 19 19 $this->call(UsersTableSeeder::class); 20 20 $this->call(DepartmentsTableSeeder::class); 21 $this->call(DocumentsTableSeeder::class);21 //$this->call(DocumentsTableSeeder::class); 22 22 } 23 23 } -
database/seeders/DepartmentsTableSeeder.php
r24a616f r120759b 16 16 public function run() 17 17 { 18 // \DB::table('departments')->insert([ 19 // [ 20 // "name" => "HR department", 21 // "code" => "14", 22 // "location" => "C:\laragon\www\SaveSpace\storage/Departments/14", 23 // "user_id" => "1", 24 // "created_at" => Carbon::now()->format('Y-m-d H:i:s'), 25 // ], 26 // [ 27 // "name" => "IT department", 28 // "code" => "01", 29 // "location" => "C:\laragon\www\SaveSpace\storage/Departments/01", 30 // "user_id" => "1", 31 // "created_at" => Carbon::now()->format('Y-m-d H:i:s'), 32 // ], 33 // [ 34 // "name" => "Business department", 35 // "code" => "12", 36 // "location" => "C:\laragon\www\SaveSpace\storage/Departments/12", 37 // "user_id" => "1", 38 // "created_at" => Carbon::now()->format('Y-m-d H:i:s'), 39 // ], 40 // ]); 41 42 Department::factory()->count(50)->create(); 18 Department::factory()->count(99)->create(); 43 19 } 44 20 } -
database/seeders/UsersTableSeeder.php
r24a616f r120759b 3 3 namespace Database\Seeders; 4 4 5 use App\Models\User; 5 6 use Carbon\Carbon; 6 7 use Illuminate\Database\Seeder; … … 28 29 ]); 29 30 30 \DB::table("users")->insert([ 31 "name" => "John", 32 "surname" => "Doe", 33 "username" => "john_doe", 34 "password" => bcrypt("Johnsecret1!"), 35 "email" => "johndoe@hotmail.com", 36 "mobile_number" => "+389 71 111 222", 37 "role_id" => 2, 38 "is_active" => true, 39 "is_confirmed" => true, 40 "created_at" => Carbon::now() 41 ]); 31 User::factory()->count(20)->create(); 42 32 43 33 }
Note:
See TracChangeset
for help on using the changeset viewer.