faker->numberBetween(1, 10); $deptCode = Department::find($deptId)->code; $name = $this->faker->unique()->firstName(); $location = 'Departments' . DIRECTORY_SEPARATOR . $deptCode . DIRECTORY_SEPARATOR . $name; Storage::disk('local')->makeDirectory($location); return [ 'arch_id' => $deptCode . "/" . $this->faker->unique()->randomNumber(), 'name' => $name, 'note' => "This a note field", 'location' => $location, 'user_id' => 1, 'department_id' => $deptId, 'version' => 1, 'created_at' => now() ]; } }