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