develop
Last change
on this file since 1c25bcf was 6f7d3df, checked in by beratkjufliju <kufliju@…>, 3 years ago |
bug fixes
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
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 phpDocumentor\Reflection\Types\Integer;
|
---|
11 | use function Sodium\increment;
|
---|
12 |
|
---|
13 | class DepartmentFactory extends Factory
|
---|
14 | {
|
---|
15 | /**
|
---|
16 | * The name of the factory's corresponding model.
|
---|
17 | *
|
---|
18 | * @var string
|
---|
19 | */
|
---|
20 | protected $model = Department::class;
|
---|
21 |
|
---|
22 | /**
|
---|
23 | * Define the model's default state.
|
---|
24 | *
|
---|
25 | * @return array
|
---|
26 | */
|
---|
27 | public function definition()
|
---|
28 | {
|
---|
29 | $location = $this->faker->unique()->numberBetween(1, 10);
|
---|
30 | Storage::disk('uploads')->makeDirectory('Departments/' . $location);
|
---|
31 | return [
|
---|
32 | 'name' => "Department" . ' ' . $this->faker->unique()->firstName(),
|
---|
33 | 'code' => $location,
|
---|
34 | 'location' => 'Departments' . DIRECTORY_SEPARATOR . $location,
|
---|
35 | 'no_of_folders' => 0,
|
---|
36 | 'user_id' => "1",
|
---|
37 | 'created_at' => now()
|
---|
38 | ];
|
---|
39 | }
|
---|
40 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.