source: database/factories/DocumentFactory.php@ 6b95845

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
RevLine 
[e6c1f87]1<?php
2
3namespace Database\Factories;
4
5use App\Models\Department;
6use App\Models\Document;
7use Carbon\Carbon;
8use Illuminate\Database\Eloquent\Factories\Factory;
9use Illuminate\Support\Facades\Storage;
10
11class 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
[ea7b12a]28 $deptID = "5";
[b9c4a92]29 $name = $this->faker->unique()->firstName();
30 Storage::disk('local')->makeDirectory('Departments' . DIRECTORY_SEPARATOR . $deptID . DIRECTORY_SEPARATOR . $name);
[e6c1f87]31
32 return [
33 'arch_id' => $deptID . "/" . $this->faker->unique()->randomNumber(),
[b9c4a92]34 'name' => $name,
[e6c1f87]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.