source: database/factories/DocumentFactory.php@ b9c4a92

develop
Last change on this file since b9c4a92 was b9c4a92, checked in by Berat Kjufliju <kufliju@…>, 3 years ago

edited file upload, seeding and departments controller

  • Property mode set to 100644
File size: 1.1 KB
Line 
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
28 $deptID = "1";
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.