Changeset 6b95845


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

Files:
3 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            }
  • resources/views/dashboard/documents/edit.blade.php

    rea7b12a r6b95845  
    174174                                                                <label class="form-label">Name</label>
    175175                                                                <input type="text" name="name" value="{{ explode('.', $file->name)[0] }}" minlength="2" maxlength="30" class="form-control" placeholder="Name" required>
     176                                                                <span>.php</span>
    176177                                                            </div>
    177178                                                        </div>
Note: See TracChangeset for help on using the changeset viewer.