source: database/factories/DepartmentFactory.php

Last change on this file was 0a1fb54, checked in by beratkjufliju <kufliju@…>, 3 years ago

bug fixes

  • Property mode set to 100644
File size: 1.0 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;
10use phpDocumentor\Reflection\Types\Integer;
11use function Sodium\increment;
12
13class DepartmentFactory extends Factory
14{
15 /**
16 * The name of the factory's corresponding model.
17 *
18 * @var string
19 */
20 protected $model = Department::class;
21
22 /**
23 * Define the model's default state.
24 *
25 * @return array
26 */
27 public function definition()
28 {
29 $location = $this->faker->unique()->numberBetween(1, 10);
30 Storage::disk('local')->makeDirectory('Departments/' . $location);
31 return [
32 'name' => "Department" . ' ' . $this->faker->unique()->firstName(),
33 'code' => $location,
34 'location' => 'Departments' . DIRECTORY_SEPARATOR . $location,
35 'no_of_folders' => 0,
36 'user_id' => "1",
37 'created_at' => now()
38 ];
39 }
40}
Note: See TracBrowser for help on using the repository browser.