source: database/factories/DepartmentFactory.php@ d795fa6

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

added validation to blades

  • Property mode set to 100644
File size: 956 bytes
RevLine 
[24a616f]1<?php
2
3namespace Database\Factories;
4
5use App\Models\Department;
[120759b]6use Carbon\Carbon;
[24a616f]7use Illuminate\Database\Eloquent\Factories\Factory;
[120759b]8use Illuminate\Support\Facades\Storage;
[24a616f]9
10class DepartmentFactory extends Factory
11{
12 /**
13 * The name of the factory's corresponding model.
14 *
15 * @var string
16 */
17 protected $model = Department::class;
18
19 /**
20 * Define the model's default state.
21 *
22 * @return array
23 */
24 public function definition()
25 {
[120759b]26 $location = $this->faker->unique()->numberBetween(1, 99);
27 Storage::disk('local')->makeDirectory('Departments/' . $location);
[24a616f]28 return [
[120759b]29 'id' => $this->faker->unique()->randomNumber(),
[d795fa6]30 'name' => $this->faker->name(),
[120759b]31 'code' => $location,
32 'location' => 'Departments/' . $location,
33 'user_id' => $this->faker->numberBetween('1', '2'),
34 'created_at' => Carbon::now()
[24a616f]35 ];
36 }
37}
Note: See TracBrowser for help on using the repository browser.