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
RevLine 
[e6c1f87]1<?php
2
3namespace Database\Factories;
4
5use App\Models\Department;
[c6b84df]6use App\Models\Folder;
[e6c1f87]7use Carbon\Carbon;
8use Illuminate\Database\Eloquent\Factories\Factory;
9use Illuminate\Support\Facades\Storage;
10
[c6b84df]11class FolderFactory extends Factory
[e6c1f87]12{
13 /**
14 * The name of the factory's corresponding model.
15 *
16 * @var string
17 */
[c6b84df]18 protected $model = Folder::class;
[e6c1f87]19
20 /**
21 * Define the model's default state.
22 *
23 * @return array
24 */
25 public function definition()
26 {
27
[c6b84df]28 $deptId = $this->faker->numberBetween('1', '15');
29 $deptCode = Department::find($deptId)->code;
[b9c4a92]30 $name = $this->faker->unique()->firstName();
[c6b84df]31
32 $location = 'Departments' . DIRECTORY_SEPARATOR . $deptCode . DIRECTORY_SEPARATOR . $name;
33 Storage::disk('uploads')->makeDirectory($location);
34
[e6c1f87]35
36 return [
[c6b84df]37 'arch_id' => $deptCode . "/" . $this->faker->unique()->randomNumber(),
[b9c4a92]38 'name' => $name,
[c6b84df]39 'note' => $this->faker->realText(),
40 'location' => $location,
[e6c1f87]41 'user_id' => $this->faker->numberBetween('1', '2'),
[c6b84df]42 'department_id' => $deptId,
[e6c1f87]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.