source: database/factories/FolderFactory.php@ c6b84df

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

added fileTypes controller, notifications, excel export, edited views

  • Property mode set to 100644
File size: 1.2 KB
Line 
1<?php
2
3namespace Database\Factories;
4
5use App\Models\Department;
6use App\Models\Folder;
7use Carbon\Carbon;
8use Illuminate\Database\Eloquent\Factories\Factory;
9use Illuminate\Support\Facades\Storage;
10
11class FolderFactory extends Factory
12{
13 /**
14 * The name of the factory's corresponding model.
15 *
16 * @var string
17 */
18 protected $model = Folder::class;
19
20 /**
21 * Define the model's default state.
22 *
23 * @return array
24 */
25 public function definition()
26 {
27
28 $deptId = $this->faker->numberBetween('1', '15');
29 $deptCode = Department::find($deptId)->code;
30 $name = $this->faker->unique()->firstName();
31
32 $location = 'Departments' . DIRECTORY_SEPARATOR . $deptCode . DIRECTORY_SEPARATOR . $name;
33 Storage::disk('uploads')->makeDirectory($location);
34
35
36 return [
37 'arch_id' => $deptCode . "/" . $this->faker->unique()->randomNumber(),
38 'name' => $name,
39 'note' => $this->faker->realText(),
40 'location' => $location,
41 'user_id' => $this->faker->numberBetween('1', '2'),
42 'department_id' => $deptId,
43 'is_important' => $this->faker->boolean,
44 'created_at' => $this->faker->dateTime()
45 ];
46 }
47}
Note: See TracBrowser for help on using the repository browser.