source: database/factories/DepartmentFactory.php@ d7aa044

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

bug fixes, edited export, added fileSeeder for DB testing

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