Ignore:
Timestamp:
11/29/21 23:10:44 (3 years ago)
Author:
beratkjufliju <kufliju@…>
Branches:
master
Children:
79aa35c
Parents:
dbc5976
Message:

added confirmation modal on userSettings

File:
1 edited

Legend:

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

    rdbc5976 rec7b69d  
    233233        $folder = Folder::find($id);
    234234
    235         $existingFolders = Folder::where(['department_id' => $folder->department->id, 'name' => $folder->name, 'arch_id' => $folder->arch_id])->count();
    236 
    237         if($existingFolders > 1 && $folder->version == 1) {
    238             Alert::flash($folder->name . " has versions", "error");
     235        $existingFolders = Folder::where(['department_id' => $folder->department->id, 'name' => $folder->name, 'arch_id' => $folder->arch_id]);
     236
     237        if($existingFolders->count() > 1 && $folder->version == 1 || $folder->version < $existingFolders->pluck('version')->max()) {
     238            Alert::flash($folder->name . " has newer versions", "error");
    239239            return redirect()->back();
    240240        }
Note: See TracChangeset for help on using the changeset viewer.