develop
Last change
on this file since 83da0d2 was 5e56e8a, checked in by beratkjufliju <kufliju@…>, 3 years ago |
edited faker
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Rev | Line | |
---|
[24a616f] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | namespace Database\Factories;
|
---|
| 4 |
|
---|
| 5 | use App\Models\Department;
|
---|
[4b7e2d3] | 6 | use App\Models\Folder;
|
---|
[120759b] | 7 | use Carbon\Carbon;
|
---|
[24a616f] | 8 | use Illuminate\Database\Eloquent\Factories\Factory;
|
---|
[120759b] | 9 | use Illuminate\Support\Facades\Storage;
|
---|
[5e56e8a] | 10 | use phpDocumentor\Reflection\Types\Integer;
|
---|
[4b7e2d3] | 11 | use function Sodium\increment;
|
---|
[24a616f] | 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 | {
|
---|
[4b7e2d3] | 29 | $location = $this->faker->unique()->numberBetween(10, 25);
|
---|
[c6b84df] | 30 | Storage::disk('uploads')->makeDirectory('Departments/' . $location);
|
---|
[24a616f] | 31 | return [
|
---|
[4b7e2d3] | 32 | 'name' => "Department" . ' ' . $this->faker->unique()->firstName(),
|
---|
[120759b] | 33 | 'code' => $location,
|
---|
[c6b84df] | 34 | 'location' => 'Departments' . DIRECTORY_SEPARATOR . $location,
|
---|
[4b7e2d3] | 35 | 'no_of_folders' => 0,
|
---|
| 36 | 'user_id' => "1",
|
---|
[b375b43] | 37 | 'created_at' => now()
|
---|
[24a616f] | 38 | ];
|
---|
| 39 | }
|
---|
| 40 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.