source: database/factories/DepartmentFactory.php@ bdda09f

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

bug fixes

  • Property mode set to 100644
File size: 1.0 KB
RevLine 
[24a616f]1<?php
2
3namespace Database\Factories;
4
5use App\Models\Department;
[4b7e2d3]6use App\Models\Folder;
[120759b]7use Carbon\Carbon;
[24a616f]8use Illuminate\Database\Eloquent\Factories\Factory;
[120759b]9use Illuminate\Support\Facades\Storage;
[5e56e8a]10use phpDocumentor\Reflection\Types\Integer;
[4b7e2d3]11use function Sodium\increment;
[24a616f]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 {
[6f7d3df]29 $location = $this->faker->unique()->numberBetween(1, 10);
[c6b84df]30 Storage::disk('uploads')->makeDirectory('Departments/' . $location);
[24a616f]31 return [
[4b7e2d3]32 'name' => "Department" . ' ' . $this->faker->unique()->firstName(),
[120759b]33 'code' => $location,
[c6b84df]34 'location' => 'Departments' . DIRECTORY_SEPARATOR . $location,
[4b7e2d3]35 'no_of_folders' => 0,
36 'user_id' => "1",
[b375b43]37 'created_at' => now()
[24a616f]38 ];
39 }
40}
Note: See TracBrowser for help on using the repository browser.