source: database/factories/DepartmentFactory.php@ b9c4a92

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

edited file upload, seeding and departments controller

  • Property mode set to 100644
File size: 974 bytes
Line 
1<?php
2
3namespace Database\Factories;
4
5use App\Models\Department;
6use Carbon\Carbon;
7use Illuminate\Database\Eloquent\Factories\Factory;
8use Illuminate\Support\Facades\Storage;
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 {
26 $location = $this->faker->randomNumber('1', '1');
27 Storage::disk('local')->makeDirectory('Departments/' . $location);
28 return [
29 'name' => "Department" . $this->faker->unique()->firstName(),
30 'code' => $location,
31 'location' => Storage::disk('local')->path('') . 'Departments' . DIRECTORY_SEPARATOR . $location,
32 'user_id' => $this->faker->numberBetween('1', '2'),
33 'created_at' => Carbon::now()
34 ];
35 }
36}
Note: See TracBrowser for help on using the repository browser.