Changeset df6e9ec
- Timestamp:
- 10/24/21 23:35:45 (3 years ago)
- Branches:
- develop, master
- Children:
- 495dd28
- Parents:
- 94f05dc
- Files:
-
- 5 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
app/Http/Controllers/Dashboard/DepartmentsController.php
r94f05dc rdf6e9ec 119 119 public function downloadAll() 120 120 { 121 $zip_file=Storage::disk('uploads')->path('Departments.zip'); 122 $zip = new \ZipArchive(); 123 $zip->open($zip_file, \ZipArchive::CREATE | \ZipArchive::OVERWRITE); 124 $path = Storage::disk('uploads')->path('Departments'); 121 try { 122 $zip_file=Storage::disk('uploads')->path('Departments.zip'); 123 $zip = new \ZipArchive(); 124 $zip->open($zip_file, \ZipArchive::CREATE | \ZipArchive::OVERWRITE); 125 $path = Storage::disk('uploads')->path('Departments'); 125 126 126 try {127 127 $files = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path)); 128 128 foreach ($files as $file) { … … 149 149 public function downloadDepartment($id) 150 150 { 151 $department = Department::find($id); 151 try { 152 $department = Department::find($id); 153 $zip_file=Storage::disk('uploads')->path('Department.zip'); 154 $zip = new \ZipArchive(); 155 $zip->open($zip_file, \ZipArchive::CREATE | \ZipArchive::OVERWRITE); 156 $path = Storage::disk('uploads')->path($department->location); 152 157 153 $zip_file=Storage::disk('uploads')->path('Department.zip');154 $zip = new \ZipArchive();155 $zip->open($zip_file, \ZipArchive::CREATE | \ZipArchive::OVERWRITE);156 $path = Storage::disk('uploads')->path($department->location);157 158 try {159 158 $files = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path)); 160 159 foreach ($files as $file) { -
app/Http/Controllers/Dashboard/FoldersController.php
r94f05dc rdf6e9ec 276 276 public function downloadfolder(Request $request, $id) 277 277 { 278 $folder = Folder::find($id);279 280 $FileSystem = new Filesystem();281 $zip_file = Storage::disk('uploads')->path('Folder.zip');282 $zip = new \ZipArchive();283 $zip->open($zip_file, \ZipArchive::CREATE | \ZipArchive::OVERWRITE);284 $path = Storage::disk('uploads')->path($folder->department->location . DIRECTORY_SEPARATOR . $folder->name);285 286 278 try { 279 $folder = Folder::find($id); 280 $FileSystem = new Filesystem(); 281 $zip_file = Storage::disk('uploads')->path('Folder.zip'); 282 $zip = new \ZipArchive(); 283 $zip->open($zip_file, \ZipArchive::CREATE | \ZipArchive::OVERWRITE); 284 285 $path = Storage::disk('uploads')->path($folder->department->location . DIRECTORY_SEPARATOR . $folder->name); 286 287 287 $files = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path)); 288 288 -
database/factories/FolderFactory.php
r94f05dc rdf6e9ec 27 27 public function definition() 28 28 { 29 $inputArray = [5, 15, 25, 35, 45, 55, 65, 75]; 30 $deptId = Arr::random($inputArray); 29 31 30 $deptCode = Department::find( 1)->code;32 $deptCode = Department::find($deptId)->code; 31 33 32 34 $name = $this->faker->unique()->firstName(); … … 41 43 'location' => $location, 42 44 'user_id' => 1, 43 'department_id' => 1,45 'department_id' => $deptId, 44 46 'is_important' => $this->faker->boolean, 45 47 'created_at' => now() -
database/seeders/FoldersTableSeeder.php
r94f05dc rdf6e9ec 17 17 public function run() 18 18 { 19 Folder::factory()->count( 5)->create();19 Folder::factory()->count(900)->create(); 20 20 $folders = Folder::all(); 21 21
Note:
See TracChangeset
for help on using the changeset viewer.