Ignore:
Timestamp:
10/19/21 18:10:01 (3 years ago)
Author:
Berat Kjufliju <kufliju@…>
Branches:
develop, master
Children:
c6b84df
Parents:
ea7b12a
Message:

edited DocumentsController

Location:
app/Http/Controllers/Dashboard
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • app/Http/Controllers/Dashboard/DepartmentsController.php

    rea7b12a r6b95845  
    88use App\Models\Department;
    99use App\Models\Document;
     10use App\Models\File;
    1011use App\Models\User;
    1112use Carbon\Carbon;
     
    6465        $department = Department::findOrFail($id);
    6566
     67        $documents = $department->document;
    6668        $oldLocation = DIRECTORY_SEPARATOR . 'Departments' . DIRECTORY_SEPARATOR . $department->code;
    6769
     
    7577                Storage::disk('local')->move($oldLocation, $location);
    7678                $department->location = Storage::disk('local')->path('') . $location;
     79            }
     80
     81            foreach ($documents as $document) {
     82                foreach($document->files as $file) {
     83                    $file->location = $location . DIRECTORY_SEPARATOR . $document->name . DIRECTORY_SEPARATOR . $file->name;
     84                    $file->save();
     85                }
    7786            }
    7887        }
  • app/Http/Controllers/Dashboard/DocumentsController.php

    rea7b12a r6b95845  
    173173                Storage::disk('local')->move($oldLocation, $location);
    174174                foreach($files as $file){
    175                     $file->location = "test";
     175                    $file->location = $location . DIRECTORY_SEPARATOR . $file->name;
     176                    $file->save();
    176177                }
    177178            }
Note: See TracChangeset for help on using the changeset viewer.