develop
Last change
on this file since b375b43 was b375b43, checked in by beratkjufliju <kufliju@…>, 3 years ago |
edited seeders
|
-
Property mode
set to
100644
|
File size:
1002 bytes
|
Line | |
---|
1 | <?php
|
---|
2 |
|
---|
3 | namespace Database\Factories;
|
---|
4 |
|
---|
5 | use App\Models\Department;
|
---|
6 | use App\Models\Folder;
|
---|
7 | use Carbon\Carbon;
|
---|
8 | use Illuminate\Database\Eloquent\Factories\Factory;
|
---|
9 | use Illuminate\Support\Facades\Storage;
|
---|
10 | use function Sodium\increment;
|
---|
11 |
|
---|
12 | class DepartmentFactory extends Factory
|
---|
13 | {
|
---|
14 | /**
|
---|
15 | * The name of the factory's corresponding model.
|
---|
16 | *
|
---|
17 | * @var string
|
---|
18 | */
|
---|
19 | protected $model = Department::class;
|
---|
20 |
|
---|
21 | /**
|
---|
22 | * Define the model's default state.
|
---|
23 | *
|
---|
24 | * @return array
|
---|
25 | */
|
---|
26 | public function definition()
|
---|
27 | {
|
---|
28 | $location = $this->faker->unique()->numberBetween(10, 25);
|
---|
29 | Storage::disk('uploads')->makeDirectory('Departments/' . $location);
|
---|
30 | return [
|
---|
31 | 'name' => "Department" . ' ' . $this->faker->unique()->firstName(),
|
---|
32 | 'code' => $location,
|
---|
33 | 'location' => 'Departments' . DIRECTORY_SEPARATOR . $location,
|
---|
34 | 'no_of_folders' => 0,
|
---|
35 | 'user_id' => "1",
|
---|
36 | 'created_at' => now()
|
---|
37 | ];
|
---|
38 | }
|
---|
39 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.