Changeset 0df7a93
- Timestamp:
- 10/24/21 20:55:11 (3 years ago)
- Branches:
- develop, master
- Children:
- 7043def
- Parents:
- e0d3f94
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
app/Http/Controllers/Dashboard/UsersController.php
re0d3f94 r0df7a93 8 8 use App\Http\Requests\Dashboard\UpdateUserRequest; 9 9 use App\Models\Avatar; 10 use App\Models\Department; 11 use App\Models\Folder; 10 12 use Carbon\Carbon; 11 13 use Illuminate\Support\Facades\File; … … 26 28 "users" => User::all(), 27 29 "roles" => Role::all(), 30 "adminAndReferents" => User::where("role_id", 1)->orWhere("role_id", 2)->get() 28 31 ]); 29 32 } … … 138 141 $user = User::find($id); 139 142 140 $user->userProfile->delete(); 141 $user->delete(); 143 if(Folder::where('user_id', $user->id)->count() == 0) { 144 if (Storage::disk("uploads")->exists("users" . DIRECTORY_SEPARATOR . $user->avatar)) { 145 Storage::disk("uploads")->delete("users" . DIRECTORY_SEPARATOR . $user->avatar); 146 } 142 147 143 Alert::flash($user->name . " deleted successfully");148 $user->delete(); 144 149 145 return redirect()->route("dashboard.users.index"); 150 Alert::flash($user->name . " deleted successfully"); 151 152 return redirect()->route("dashboard.users.index"); 153 } 154 else { 155 Alert::flash($user->name . "has associated folders"); 156 157 return redirect()->back(); 158 } 146 159 } 147 160 -
app/Models/Department.php
re0d3f94 r0df7a93 28 28 return $this->hasMany(Folder::class); 29 29 } 30 31 // public function getDeptId(){ 32 // return Department::where('id', $this->id)->get(); 33 // } 30 34 } -
app/Models/User.php
re0d3f94 r0df7a93 134 134 return User::where('id', $this->created_by)->pluck('username')->first(); 135 135 } 136 137 public function folder() { 138 return $this->hasMany(Folder::class); 139 } 136 140 } -
database/factories/FolderFactory.php
re0d3f94 r0df7a93 27 27 public function definition() 28 28 { 29 $array = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105, 115, 125, 135, 145]; 30 31 $deptId = Arr::random($array); 29 $deptId = 1; 32 30 33 31 $deptCode = Department::find($deptId)->code; 32 34 33 $name = $this->faker->unique()->firstName(); 35 34 -
database/seeders/PermissionsTableSeeder.php
re0d3f94 r0df7a93 17 17 { 18 18 \DB::table('permissions')->insert([ 19 ["id" => "1", "name" => " create_user"],// Create new user19 ["id" => "1", "name" => "view_all_users"], // Create new user 20 20 ["id" => "2", "name" => "manage_all_users"], // Access all users to manage 21 21 ["id" => "3", "name" => "manage_all_departments"], // Access all departments to manage … … 27 27 ["id" => "9", "name" => "delete_all_folders"], // Delete all folder/s 28 28 ["id" => "10", "name" => "delete_folder"], // Delete your folder/s 29 ["id" => "11", "name" => "manage_all_files"], // Access all files 30 ["id" => "12", "name" => "manage_file_types"], // Access file types 29 ["id" => "11", "name" => "view_all_files"], // View all files 30 ["id" => "12", "name" => "manage_all_files"], // Access all files 31 ["id" => "13", "name" => "manage_file_types"], // Access file types 32 ["id" => "14", "name" => "edit_user_data"], // Access file types 33 ["id" => "15", "name" => "export_data"], // Access file types 34 ["id" => "16", "name" => "validation_data"] // Access file types 31 35 ]); 32 36 } -
database/seeders/RolesPermissionsTableSeeder.php
re0d3f94 r0df7a93 28 28 ["role_id" => 1, "permission_id" => 11], 29 29 ["role_id" => 1, "permission_id" => 12], 30 ["role_id" => 1, "permission_id" => 13], 31 ["role_id" => 1, "permission_id" => 14], 32 ["role_id" => 1, "permission_id" => 15], 30 33 31 // Referent 34 // Referent 35 ["role_id" => 2, "permission_id" => 1], 32 36 ["role_id" => 2, "permission_id" => 3], 33 37 ["role_id" => 2, "permission_id" => 4], … … 39 43 ["role_id" => 2, "permission_id" => 10], 40 44 ["role_id" => 2, "permission_id" => 11], 45 ["role_id" => 2, "permission_id" => 13], 46 ["role_id" => 2, "permission_id" => 14], 47 ["role_id" => 2, "permission_id" => 15], 41 48 42 49 // Viewer 43 50 ["role_id" => 3, "permission_id" => 5], 44 51 ["role_id" => 3, "permission_id" => 6], 52 ["role_id" => 3, "permission_id" => 11], 45 53 ]); 46 54 } -
database/seeders/UsersTableSeeder.php
re0d3f94 r0df7a93 20 20 "name" => "Berat", 21 21 "surname" => "Kjufliju", 22 "username" => " beratk",22 "username" => "admin", 23 23 "password" => bcrypt("123456"), 24 24 "email" => "kufliju@gmail.com", … … 31 31 ]); 32 32 33 \DB::table("users")->insert([ 34 "id" => "2", 35 "name" => "Berat", 36 "surname" => "Kjufliju", 37 "username" => "referent", 38 "password" => bcrypt("123456"), 39 "email" => "mail@host.com", 40 "phone_number" => "+38971201236", 41 "role_id" => 2, 42 "is_active" => true, 43 "is_confirmed" => true, 44 "created_by" => "1", 45 "created_at" => now() 46 ]); 47 48 \DB::table("users")->insert([ 49 "id" => "3", 50 "name" => "Berat", 51 "surname" => "Kjufliju", 52 "username" => "viewer", 53 "password" => bcrypt("123456"), 54 "email" => "test@test.com", 55 "phone_number" => "+38971201235", 56 "role_id" => 3, 57 "is_active" => true, 58 "is_confirmed" => true, 59 "created_by" => "1", 60 "created_at" => now() 61 ]); 62 33 63 User::factory()->count(50)->create(); 34 64 -
resources/views/dashboard/departments/index.blade.php
re0d3f94 r0df7a93 20 20 </nav> 21 21 <div class="dropdown"> 22 @if(auth()->user()->hasPermission('manage_all_departments')) 22 23 <a href="javascript:void(0)" data-toggle="modal" data-target="#createModal" class="btn btn-primary text-white"> 23 24 <i class="fa fa-plus pr-1"></i> New 24 25 </a> 26 @endif 27 28 @if(auth()->user()->hasPermission('download_data')) 25 29 <a href="{{ route("dashboard.departments.downloadAll") }}" class="btn btn-danger text-white"> 26 30 <i class="fa fa-download pr-1"></i> Download 27 31 </a> 32 @endif 33 @if(auth()->user()->hasPermission('export_data')) 28 34 <a href="{{ route('dashboard.departments.export') }}" class="btn btn-success text-white"> 29 35 <i class="fa fa-table pr-1"></i> Export</a> 36 @endif 30 37 </div> 31 38 </div> … … 73 80 </svg></button> 74 81 </td> 82 @if(auth()->user()->hasPermission('manage_all_departments')) 75 83 <td> 76 84 <a href="javascript:void(0)" class="text-secondary" data-toggle="modal" data-target="#editModal_{{$department->id}}" title="Edit"> 77 85 <i class="ti-pencil"></i> 78 86 </a> 79 <a href="{{ route("dashboard.departments.downloadDepartment", ['id' => $department->id]) }}" class="text-danger ml-2"title="Delete"> 87 @if(auth()->user()->hasPermission('download_data')) 88 <a href="{{ route("dashboard.departments.downloadDepartment", ['id' => $department->id]) }}" class="text-danger ml-2"title="Download"> 80 89 <i class="ti-download"></i> 81 90 </a> 91 @endif 82 92 <a href="javascript:void(0)" class="text-danger ml-2" data-toggle="modal" data-target="#deleteModal_{{$department->id}}" title="Delete"> 83 93 <i class="ti-trash"></i> 84 94 </a> 85 95 </td> 96 @else 97 <td></td> 98 @endif 86 99 </tr> 87 100 <div class="modal fade" id="deleteModal_{{$department->id}}" tabindex="-1" role="dialog" aria-hidden="true"> … … 99 112 @method('DELETE') 100 113 <p>Are you sure you want to delete department {{$department->name}} with code: {{$department->code}}?</p> 101 <p>Number of documents associated: <a href="{{ route("dashboard.folders.index", ['id' => $department->id]) }}" class="text-linkedin">{{$department->folder()->count()}}</a></p>114 <p>Number of folders associated: <a href="{{ route("dashboard.folders.index", ['id' => $department->id]) }}" class="text-linkedin">{{$department->folder()->count()}}</a></p> 102 115 <div class="modal-footer"> 103 116 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close -
resources/views/dashboard/files/index.blade.php
re0d3f94 r0df7a93 20 20 </nav> 21 21 <div class="dropdown"> 22 @if(auth()->user()->hasPermission('manage_all_files')) 22 23 <a href="javascript:void(0)" data-toggle="modal" data-target="#createModal" class="btn btn-primary text-white"> 23 24 <i class="fa fa-upload pr-1"></i> Upload 24 25 </a> 26 @endif 27 @if(auth()->user()->hasPermission('download_data')) 25 28 <a href="{{ route("dashboard.departments.downloadAll") }}" class="btn btn-danger text-white"> 26 29 <i class="fa fa-download pr-1"></i> Download 27 30 </a> 31 @endif 32 @if(auth()->user()->hasPermission('export_data')) 28 33 <a href="{{ route('dashboard.files.export') }}" class="btn btn-success text-white"> 29 34 <i class="fa fa-table pr-1"></i> Export 30 35 </a> 36 @endif 31 37 </div> 32 38 </div> … … 103 109 </svg></button> 104 110 </td> 111 @if(auth()->user()->hasPermission('manage_all_files')) 105 112 <td> 106 113 <a href="javascript:void(0)" class="text-secondary" data-toggle="modal" data-target="#editModal_{{$file->id}}" title="Edit"> … … 114 121 </a> 115 122 </td> 123 @else 124 <td></td> 125 @endif 116 126 </tr> 117 127 <div class="modal fade" id="deleteModal_{{$file->id}}" tabindex="-1" role="dialog" aria-hidden="true"> -
resources/views/dashboard/folders/files.blade.php
re0d3f94 r0df7a93 9 9 <div class="card"> 10 10 <div class="card-body"> 11 @if(auth()->user()->hasPermission('manage_all_folders')) 11 12 <a class="btn btn-secondary btn-block text-white" href="javascript:void(0)" data-target="#editModal_{{$folder->id}}" data-toggle="modal"> 12 13 Upload 13 14 </a> 15 @endif 14 16 </div> 15 17 <div class="app-sidebar-menu"> … … 35 37 <div class="action-left"> 36 38 <ul class="list-inline"> 39 @if(auth()->user()->hasPermission('manage_all_folders')) 37 40 <li class="list-inline-item mb-0"> 38 41 <a href="#" class="btn btn-outline-light dropdown-toggle" data-toggle="dropdown"> … … 43 46 Upload 44 47 </a> 45 46 48 </div> 47 49 </li> 50 @endif 48 51 <li class="list-inline-item mb-0"> 52 @if(auth()->user()->hasPermission('download_data')) 49 53 <a href="{{ route("dashboard.folders.downloadFolder", ['id' => $folder->id]) }}" class="btn btn-outline-light"> 50 54 Download folder 51 55 </a> 56 @endif 52 57 </li> 53 58 </ul> … … 100 105 </a> 101 106 <div class="dropdown-menu dropdown-menu-right"> 107 @if(auth()->user()->hasPermission('manage_all_files')) 102 108 <a href="javascript:void(0)" class="dropdown-item" data-toggle="modal" data-target="#editFileModal_{{$file->id}}"> 103 109 Rename 104 110 </a> 111 @endif 112 @if(auth()->user()->hasPermission('download_data')) 105 113 <a href="{{ route("dashboard.files.downloadFile", $file->id) }}" class="dropdown-item"> 106 114 Download 107 115 </a> 116 @endif 117 @if(auth()->user()->hasPermission('manage_all_files')) 108 118 <a href="javascript:void(0)" class="dropdown-item" data-toggle="modal" data-target="#deleteModal_{{$file->id}}"> 109 119 Delete 110 120 </a> 121 @endif 111 122 </div> 112 123 </div> -
resources/views/dashboard/folders/index.blade.php
re0d3f94 r0df7a93 9 9 <div class="card"> 10 10 <div class="card-body"> 11 @if(auth()->user()->hasPermission('manage_all_folders')) 11 12 <a href="javascript:void(0)" class="btn btn-secondary btn-block file-upload-btn text-white" data-toggle="modal" data-target="#createModal"> 12 13 Add folder 13 14 </a> 15 @endif 14 16 </div> 15 17 <div class="app-sidebar-menu"> … … 62 64 <div class="action-left"> 63 65 <ul class="list-inline"> 66 @if(auth()->user()->hasPermission('manage_all_folders')) 64 67 <li class="list-inline-item mb-0"> 65 68 <a href="#" class="btn btn-outline-light dropdown-toggle" data-toggle="dropdown"> 66 69 <i data-feather="plus" class="mr-1"></i> 67 A tions70 Actions 68 71 </a> 69 72 <div class="dropdown-menu"> 70 73 <a class="dropdown-item" href="javascript:void(0)" data-toggle="modal" data-target="#createModal">Add folder</a> 74 @endif 75 @if(auth()->user()->hasPermission('export_data')) 71 76 <a href="{{ route('dashboard.folders.export') }}" class="dropdown-item text-success">Export</a> 72 77 </div> 73 78 </li> 79 @endif 74 80 <li class="list-inline-item mb-0"> 75 81 <a href="#" class="btn btn-outline-light dropdown-toggle" data-toggle="dropdown">Departments</a> … … 139 145 <div class="dropdown-menu dropdown-menu-right"> 140 146 <a href="{{ route("dashboard.folders.files", ["id" => $folder->id]) }}" class="dropdown-item">View Files</a> 147 @if(auth()->user()->hasPermission('manage_all_folders')) 141 148 <a href="javascript:void(0)" class="dropdown-item" data-toggle="modal" data-target="#editModal_{{$folder->id}}">Edit</a> 149 @endif 150 @if(auth()->user()->hasPermission('download_data')) 142 151 <a href="{{ route("dashboard.folders.downloadFolder", ['id' => $folder->id]) }}" class="dropdown-item">Download</a> 143 <button class="dropdown-item action-dropdown-item" 152 @endif 153 @if(auth()->user()->hasPermission('manage_all_folders')) 154 <button class="dropdown-item action-dropdown-item" 144 155 href="javascript:void(0)" onclick="toggleImportant({{$folder->id}})"> 145 156 @if($folder->is_important) … … 149 160 @endif 150 161 </button> 162 @endif 163 @if(auth()->user()->hasPermission('manage_all_folders')) 151 164 <a href="javascript:void(0)" class="dropdown-item" data-toggle="modal" data-target="#deleteModal_{{$folder->id}}">Delete</a> 165 @endif 152 166 </div> 153 167 </div> -
resources/views/dashboard/index.blade.php
re0d3f94 r0df7a93 159 159 @endif 160 160 @endif 161 162 163 161 </td> 164 162 <td>{{ $file->name }}</td> … … 177 175 </svg></button> 178 176 </td> 177 @if(auth()->user()->hasPermission('manage_all_files')) 179 178 <td> 180 179 <a href="javascript:void(0)" class="text-secondary" data-toggle="modal" data-target="#editModal_{{$file->id}}" title="Edit"> … … 188 187 </a> 189 188 </td> 189 @else 190 <td></td> 191 @endif 190 192 </tr> 191 193 <div class="modal fade" id="deleteModal_{{$file->id}}" tabindex="-1" role="dialog" aria-hidden="true"> -
resources/views/dashboard/settings/index.blade.php
re0d3f94 r0df7a93 24 24 <a class="nav-link {{$active_tab == 'account' ? 'active' : ""}}" id="account-tab" data-toggle="pill" href="#account" role="tab" aria-controls="account" aria-selected="true">Account</a> 25 25 <a class="nav-link {{$active_tab == 'security' ? 'active' : ""}}" id="security-tab" data-toggle="pill" href="#security" role="tab" aria-controls="security" aria-selected="false">Security</a> 26 @if(auth()->user()->hasPermission('validation_data')) 26 27 <a class="nav-link {{$active_tab == 'file-types' ? 'active' : ""}}" id="file-types-tab" data-toggle="pill" href="#file-types" role="tab" aria-controls="file-types" aria-selected="false">File validation</a> 28 @endif 27 29 </div> 28 30 </div> … … 233 235 </div> 234 236 <div class="tab-pane {{$active_tab == 'file-types' ? 'active' : ""}}" id="file-types" role="tabpanel" aria-labelledby="file-types-tab"> 235 237 @if(auth()->user()->hasPermission('validation_data')) 236 238 <div class="card"> 237 239 <div class="card-body"> … … 259 261 </div> 260 262 </div> 261 263 @endif 262 264 </div> 263 265 </div> -
resources/views/dashboard/users/index.blade.php
re0d3f94 r0df7a93 21 21 </nav> 22 22 <div class="dropdown"> 23 @if(auth()->user()->hasPermission('manage_all_users')) 23 24 <a href="javascript:void(0)" data-toggle="modal" data-target="#createModal" class="btn btn-primary text-white"> 24 25 <i class="fa fa-plus pr-1"></i> New 25 26 </a> 27 @endif 28 @if(auth()->user()->hasPermission('export_data')) 26 29 <a href="{{ route('dashboard.users.export') }}" class="btn btn-success text-white"> 27 30 <i class="fa fa-table pr-1"></i> Export 28 31 </a> 32 @endif 29 33 </div> 30 34 </div> … … 93 97 @endif 94 98 </td> 99 @if(auth()->user()->hasPermission('manage_all_users')) 95 100 @if($user->hasRole("Referent") && $user->is_confirmed) 96 101 <td> … … 98 103 <i class="ti-pencil"></i> 99 104 </a> 100 <a href="javascript:void(0)" class="text-danger ml-2" data- action="{{ route("dashboard.users.destroy", ["id" => $user->id]) }}" data-method="delete" title="Delete">105 <a href="javascript:void(0)" class="text-danger ml-2" data-toggle="modal" data-target="#deleteModal_{{$user->id}}" title="Delete"> 101 106 <i class="ti-trash"></i> 102 107 </a> … … 105 110 <td>/</td> 106 111 @endif 112 @else 113 <td></td> 114 @endif 107 115 </tr> 108 116 … … 199 207 </div> 200 208 209 <div class="modal fade" id="deleteModal_{{$user->id}}" tabindex="-1" role="dialog" aria-hidden="true"> 210 <div class="modal-dialog modal-dialog-centered" role="document"> 211 <div class="modal-content"> 212 <div class="modal-header"> 213 <h5 class="modal-title" id="exampleModalCenterTitle">Delete confirmation</h5> 214 <button type="button" class="close" data-dismiss="modal" aria-label="Close"> 215 <i class="ti-close"></i> 216 </button> 217 </div> 218 <div class="modal-body"> 219 <form action="{{ route("dashboard.users.destroy", $user->id) }}" method="POST"> 220 @csrf 221 @method('DELETE') 222 <p>Are you sure you want to delete user {{$user->username}} ?</p> 223 <p>Number of folders created: <a href="{{ route("dashboard.folders.index", ['id' => $user->id]) }}" class="text-linkedin">{{\App\Models\Folder::where('user_id', $user->id)->count()}}</a></p> 224 <div class="modal-footer"> 225 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close 226 </button> 227 <button type="submit" class="btn btn-primary">Save changes</button> 228 </div> 229 </form> 230 </div> 231 232 </div> 233 </div> 234 </div> 201 235 @endforeach 202 236 </tbody> -
resources/views/layouts/app.blade.php
re0d3f94 r0df7a93 168 168 </li> 169 169 @endif 170 @if(auth()->user()->hasPermission(" manage_all_departments"))170 @if(auth()->user()->hasPermission("view_all_departments")) 171 171 <li> 172 172 <a href="{{route("dashboard.departments.index")}}" data-toggle="tooltip" … … 176 176 </li> 177 177 @endif 178 @if(auth()->user()->hasPermission(" manage_all_folders"))178 @if(auth()->user()->hasPermission("view_all_folders")) 179 179 <li> 180 180 <a href="{{route("dashboard.folders.index")}}" data-toggle="tooltip" … … 184 184 </li> 185 185 @endif 186 @if(auth()->user()->hasPermission(" manage_all_files"))186 @if(auth()->user()->hasPermission("view_all_files")) 187 187 <li> 188 188 <a href="{{route("dashboard.files.index")}}" data-toggle="tooltip" -
routes/web.php
re0d3f94 r0df7a93 55 55 // Settings 56 56 Route::get("/settings", "Dashboard\SettingsController@settings")->name("dashboard.settings.index"); 57 Route::patch("/settings/personal", "Dashboard\SettingsController@updatePersonalInformation")->name("dashboard.settings.personal");58 57 Route::patch("/settings/username", "Dashboard\SettingsController@updateUsername")->name("dashboard.settings.username"); 59 58 Route::patch("/settings/password", "Dashboard\SettingsController@updatePassword")->name("dashboard.settings.password"); 60 59 Route::patch("/settings/email", "Dashboard\SettingsController@updateEmail")->name("dashboard.settings.email"); 61 Route::patch("/ settings/file-types", "Dashboard\SettingsController@fileTypes")->name("dashboard.settings.file-types");60 Route::patch("/users/{id}/editUserData", "Dashboard\UsersController@editUserData")->name("dashboard.users.editUserData"); 62 61 63 64 // Users 65 Route::group(['middleware' => 'permission:manage_all_users'], function () { 66 Route::get("/users", "Dashboard\UsersController@index")->name("dashboard.users.index"); 67 Route::patch("/users/{id}/block", "Dashboard\UsersController@block")->name("dashboard.users.block"); 68 Route::patch("/users/{id}/unblock", "Dashboard\UsersController@unblock")->name("dashboard.users.unblock"); 69 Route::delete("/users/{id}/destroy", "Dashboard\UsersController@destroy")->name("dashboard.users.destroy"); 62 //Settings File Validations 63 Route::group(['middleware' => 'permission:manage_file_types'], function () { 64 Route::patch("/settings/file-types", "Dashboard\SettingsController@fileTypes")->name("dashboard.settings.file-types"); 70 65 }); 71 66 72 Route::group(['middleware' => 'permission:create_user'], function () { 67 // Users view 68 Route::group(['middleware' => 'permission:view_all_users'], function () { 69 Route::get("/users", "Dashboard\UsersController@index")->name("dashboard.users.index"); 70 }); 71 72 Route::group(['middleware' => 'permission:manage_all_users'], function () { 73 73 Route::get("/users/create", "Dashboard\UsersController@create")->name("dashboard.users.create"); 74 74 Route::post("/users/store", "Dashboard\UsersController@store")->name("dashboard.users.store"); 75 75 Route::get("/users/{id}/edit", "Dashboard\UsersController@editShow")->name("dashboard.users.editShow"); 76 76 Route::patch("/users/{id}/edit", "Dashboard\UsersController@edit")->name("dashboard.users.edit"); 77 Route::patch("/users/{id}/editUserData", "Dashboard\UsersController@editUserData")->name("dashboard.users.editUserData"); 77 Route::patch("/users/{id}/block", "Dashboard\UsersController@block")->name("dashboard.users.block"); 78 Route::patch("/users/{id}/unblock", "Dashboard\UsersController@unblock")->name("dashboard.users.unblock"); 79 Route::delete("/users/{id}/destroy", "Dashboard\UsersController@destroy")->name("dashboard.users.destroy"); 78 80 Route::get('users/export', 'Dashboard\ExportExcelController@ExportUsers')->name("dashboard.users.export"); 79 81 }); 80 82 81 // Departments 83 // Departments view 84 Route::group(['middleware' => 'permission:view_all_departments'], function () { 85 Route::get("/departments", "Dashboard\DepartmentsController@index")->name("dashboard.departments.index"); 86 }); 87 88 // Departments manage 82 89 Route::group(['middleware' => 'permission:manage_all_departments'], function () { 83 Route::get("/departments", "Dashboard\DepartmentsController@index")->name("dashboard.departments.index");84 90 Route::get("/departments/create", "Dashboard\DepartmentsController@create")->name("dashboard.departments.create"); 85 91 Route::post("/departments/store", "Dashboard\DepartmentsController@store")->name("dashboard.departments.store"); … … 87 93 Route::patch("/departments/{id}/edit", "Dashboard\DepartmentsController@edit")->name("dashboard.departments.edit"); 88 94 Route::delete("/departments/{id}/destroy", "Dashboard\DepartmentsController@destroy")->name("dashboard.departments.destroy"); 89 Route::get('/departments/download-all','Dashboard\DepartmentsController@downloadAll')->name('dashboard.departments.downloadAll'); 90 Route::get('/departments/{id}/download-department','Dashboard\DepartmentsController@downloadDepartment')->name('dashboard.departments.downloadDepartment'); 95 }); 96 97 // Folders view 98 Route::group(['middleware' => 'permission:view_all_folders'], function () { 99 Route::get("/folders", "Dashboard\FoldersController@index")->name("dashboard.folders.index"); 100 Route::get('/folders/{id}/files', 'Dashboard\FoldersController@files')->name('dashboard.folders.files'); 101 }); 102 103 // Folders manage 104 Route::group(['middleware' => 'permission:manage_all_folders'], function () { 105 Route::get("/folders/create", "Dashboard\FoldersController@create")->name("dashboard.folders.create"); 106 Route::post("/folders/store", "Dashboard\FoldersController@store")->name("dashboard.folders.store"); 107 Route::get("/folders/{id}/edit", "Dashboard\FoldersController@editShow")->name("dashboard.folders.editShow"); 108 Route::patch("/folders/{id}/edit", "Dashboard\FoldersController@edit")->name("dashboard.folders.edit"); 109 Route::patch("/folders/{id}/block", "Dashboard\FoldersController@block")->name("dashboard.folders.block"); 110 Route::patch("/folders/{id}/unblock", "Dashboard\FoldersController@unblock")->name("dashboard.folders.unblock"); 111 Route::patch("/folders/{id}/confirm", "Dashboard\FoldersController@confirm")->name("dashboard.folders.confirm"); 112 Route::delete("/folders/{id}/destroy", "Dashboard\FoldersController@destroy")->name("dashboard.folders.destroy"); 113 Route::patch('/folders/toggle-important/{id}', "Dashboard\FoldersController@toggleImportant")->name("dashboard.folders.toggleImportant"); 114 }); 115 116 // Files view 117 Route::group(['middleware' => 'permission:view_all_files'], function () { 118 Route::get("files", "Dashboard\FilesController@index")->name("dashboard.files.index"); 119 }); 120 121 //Files manage 122 Route::group(['middleware' => 'permission:manage_all_files'], function () { 123 Route::patch("files/{id}/rename-file", "Dashboard\FilesController@renameFile")->name("dashboard.files.renameFile"); 124 Route::post("/files/store", "Dashboard\FilesController@store")->name("dashboard.files.store"); 125 Route::delete("files/{id}/delete-file", "Dashboard\FilesController@deleteFile")->name("dashboard.files.deleteFile"); 126 }); 127 128 //Export data 129 Route::group(['middleware' => 'permission:export_data'], function () { 130 Route::get('files/export', 'Dashboard\ExportExcelController@ExportFiles')->name("dashboard.files.export"); 131 Route::get('folders/export', 'Dashboard\ExportExcelController@ExportFolders')->name("dashboard.folders.export"); 91 132 Route::get('departments/export', 'Dashboard\ExportExcelController@ExportDepartments')->name("dashboard.departments.export"); 92 133 }); 93 134 94 // Folders 95 Route::get("/folders", "Dashboard\FoldersController@index")->name("dashboard.folders.index"); 96 Route::get("/folders/create", "Dashboard\FoldersController@create")->name("dashboard.folders.create"); 97 Route::post("/folders/store", "Dashboard\FoldersController@store")->name("dashboard.folders.store"); 98 Route::get("/folders/{id}/edit", "Dashboard\FoldersController@editShow")->name("dashboard.folders.editShow"); 99 Route::patch("/folders/{id}/edit", "Dashboard\FoldersController@edit")->name("dashboard.folders.edit"); 100 Route::patch("/folders/{id}/block", "Dashboard\FoldersController@block")->name("dashboard.folders.block"); 101 Route::patch("/folders/{id}/unblock", "Dashboard\FoldersController@unblock")->name("dashboard.folders.unblock"); 102 Route::patch("/folders/{id}/confirm", "Dashboard\FoldersController@confirm")->name("dashboard.folders.confirm"); 103 Route::delete("/folders/{id}/destroy", "Dashboard\FoldersController@destroy")->name("dashboard.folders.destroy"); 104 Route::patch('/folders/toggle-important/{id}', "Dashboard\FoldersController@toggleImportant")->name("dashboard.folders.toggleImportant"); 105 Route::get('/folders/{id}/download-folder','Dashboard\FoldersController@downloadFolder')->name('dashboard.folders.downloadFolder'); 106 Route::get('/folders/{id}/files','Dashboard\FoldersController@files')->name('dashboard.folders.files'); 107 Route::get('folders/export', 'Dashboard\ExportExcelController@ExportFolders')->name("dashboard.folders.export"); 108 109 // Files 110 Route::get("files", "Dashboard\FilesController@index")->name("dashboard.files.index"); 111 Route::get("files/{id}/download-file", "Dashboard\FilesController@downloadFile")->name("dashboard.files.downloadFile"); 112 Route::patch("files/{id}/rename-file", "Dashboard\FilesController@renameFile")->name("dashboard.files.renameFile"); 113 Route::post("/files/store", "Dashboard\FilesController@store")->name("dashboard.files.store"); 114 Route::delete("files/{id}/delete-file", "Dashboard\FilesController@deleteFile")->name("dashboard.files.deleteFile"); 115 Route::get('files/export', 'Dashboard\ExportExcelController@ExportFiles')->name("dashboard.files.export"); 116 135 //Download data 136 Route::group(['middleware' => 'permission:download_data'], function () { 137 Route::get('/departments/download-all', 'Dashboard\DepartmentsController@downloadAll')->name('dashboard.departments.downloadAll'); 138 Route::get("files/{id}/download-file", "Dashboard\FilesController@downloadFile")->name("dashboard.files.downloadFile"); 139 Route::get('/folders/{id}/download-folder', 'Dashboard\FoldersController@downloadFolder')->name('dashboard.folders.downloadFolder'); 140 Route::get('/departments/{id}/download-department', 'Dashboard\DepartmentsController@downloadDepartment')->name('dashboard.departments.downloadDepartment'); 141 }); 117 142 });
Note:
See TracChangeset
for help on using the changeset viewer.