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