develop
Last change
on this file since a0635eb was 4b7e2d3, checked in by beratkjufliju <kufliju@…>, 3 years ago |
bug fixes, edited export, added fileSeeder for DB testing
|
-
Property mode
set to
100644
|
File size:
1021 bytes
|
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;
|
---|
[4b7e2d3] | 10 | use function Sodium\increment;
|
---|
[24a616f] | 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 | {
|
---|
[4b7e2d3] | 28 | $location = $this->faker->unique()->numberBetween(10, 25);
|
---|
[c6b84df] | 29 | Storage::disk('uploads')->makeDirectory('Departments/' . $location);
|
---|
[24a616f] | 30 | return [
|
---|
[4b7e2d3] | 31 | 'name' => "Department" . ' ' . $this->faker->unique()->firstName(),
|
---|
[120759b] | 32 | 'code' => $location,
|
---|
[c6b84df] | 33 | 'location' => 'Departments' . DIRECTORY_SEPARATOR . $location,
|
---|
[4b7e2d3] | 34 | 'no_of_folders' => 0,
|
---|
| 35 | 'user_id' => "1",
|
---|
| 36 | 'created_at' => $this->faker->dateTime()
|
---|
[24a616f] | 37 | ];
|
---|
| 38 | }
|
---|
| 39 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.