Changeset c6b84df for database/factories


Ignore:
Timestamp:
10/21/21 23:45:59 (3 years ago)
Author:
beratkjufliju <kufliju@…>
Branches:
develop, master
Children:
4b7e2d3
Parents:
6b95845
Message:

added fileTypes controller, notifications, excel export, edited views

Location:
database/factories
Files:
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • database/factories/DepartmentFactory.php

    r6b95845 rc6b84df  
    2424    public function definition()
    2525    {
    26         $location = $this->faker->unique()->numberBetween('1', '9');
    27         Storage::disk('local')->makeDirectory('Departments/' . $location);
     26        $location = $this->faker->unique()->numberBetween(1, 15);
     27        Storage::disk('uploads')->makeDirectory('Departments/' . $location);
    2828        return [
    2929            'name' => "Department" . $this->faker->unique()->firstName(),
    3030            'code' => $location,
    31             'location' => Storage::disk('local')->path('') . 'Departments' . DIRECTORY_SEPARATOR . $location,
     31            'location' => 'Departments' . DIRECTORY_SEPARATOR . $location,
    3232            'user_id' => $this->faker->numberBetween('1', '2'),
    3333            'created_at' => Carbon::now()
  • database/factories/FolderFactory.php

    r6b95845 rc6b84df  
    44
    55use App\Models\Department;
    6 use App\Models\Document;
     6use App\Models\Folder;
    77use Carbon\Carbon;
    88use Illuminate\Database\Eloquent\Factories\Factory;
    99use Illuminate\Support\Facades\Storage;
    1010
    11 class DocumentFactory extends Factory
     11class FolderFactory extends Factory
    1212{
    1313    /**
     
    1616     * @var string
    1717     */
    18     protected $model = Document::class;
     18    protected $model = Folder::class;
    1919
    2020    /**
     
    2626    {
    2727
    28         $deptID = "5";
     28        $deptId = $this->faker->numberBetween('1', '15');
     29        $deptCode = Department::find($deptId)->code;
    2930        $name = $this->faker->unique()->firstName();
    30         Storage::disk('local')->makeDirectory('Departments' . DIRECTORY_SEPARATOR . $deptID . DIRECTORY_SEPARATOR . $name);
     31
     32        $location = 'Departments' . DIRECTORY_SEPARATOR . $deptCode . DIRECTORY_SEPARATOR . $name;
     33        Storage::disk('uploads')->makeDirectory($location);
     34
    3135
    3236        return [
    33             'arch_id' => $deptID . "/" . $this->faker->unique()->randomNumber(),
     37            'arch_id' => $deptCode . "/" . $this->faker->unique()->randomNumber(),
    3438            'name' => $name,
    35             'description' => $this->faker->realText(),
     39            'note' => $this->faker->realText(),
     40            'location' => $location,
    3641            'user_id' => $this->faker->numberBetween('1', '2'),
    37             'department_id' => $deptID,
     42            'department_id' => $deptId,
    3843            'is_important' => $this->faker->boolean,
    3944            'created_at' => $this->faker->dateTime()
    4045        ];
    41 
    4246    }
    4347}
Note: See TracChangeset for help on using the changeset viewer.