Changeset 0a1fb54 for app/Http/Controllers
- Timestamp:
- 11/23/21 22:01:52 (3 years ago)
- Branches:
- master
- Children:
- dbc5976
- Parents:
- 4d73966
- Location:
- app/Http/Controllers
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
app/Http/Controllers/Auth/CreatePasswordController.php
r4d73966 r0a1fb54 36 36 $user->save(); 37 37 38 return redirect()->route("auth. loginShow");38 return redirect()->route("auth.showLogin"); 39 39 } 40 40 } -
app/Http/Controllers/Auth/VerifyLoginController.php
r4d73966 r0a1fb54 6 6 use App\Http\Controllers\Controller; 7 7 use App\Models\User; 8 use App\Notifications\VerifyUser; 8 9 use Illuminate\Http\Request; 9 10 use App\Services\Hashid; 11 use Illuminate\Support\Carbon; 10 12 11 13 class VerifyLoginController extends Controller -
app/Http/Controllers/Dashboard/DepartmentsController.php
r4d73966 r0a1fb54 27 27 } 28 28 29 public function create()30 {31 return view("dashboard.departments.create");32 }33 34 29 public function store(NewDepartmentRequest $request) 35 30 { … … 48 43 $department->user_id = auth()->id(); 49 44 50 $users = User::all();51 52 45 $department->save(); 53 46 … … 55 48 56 49 return redirect()->route("dashboard.departments.index"); 57 }58 59 public function editShow($id)60 {61 return view("dashboard.departments.edit")->with([62 "department" => Department::findOrFail($id)63 ]);64 50 } 65 51 … … 79 65 $location = 'Departments' . DIRECTORY_SEPARATOR . $request->code; 80 66 81 if(!Storage::disk('local')->has($location) && Folder::where('department_id', $department->id)->pluck('no_of_files')->first() > 0){67 if(!Storage::disk('local')->has($location) ){ 82 68 Storage::disk('local')->move($oldLocation, $location); 83 69 $department->location = $location; … … 88 74 $folder->arch_id = $department->code . '/' . $currArchId; 89 75 $folder->save(); 76 90 77 foreach($folder->files as $file) { 78 //dd($file); 91 79 $file->location = $location . DIRECTORY_SEPARATOR . $folder->name . DIRECTORY_SEPARATOR . $file->name; 92 80 $file->save(); -
app/Http/Controllers/Dashboard/FilesController.php
r4d73966 r0a1fb54 57 57 58 58 if(File::where(['folder_id' => $folder->id, 'name' => $fileName])->count() > 0) { 59 59 60 Alert::flash("The uploaded file already exists", "error"); 60 61 61 return redirect()->back(); 62 62 } -
app/Http/Controllers/Dashboard/FoldersController.php
r4d73966 r0a1fb54 36 36 37 37 if ($request->query('sort') == 'newest') { 38 $folders = $foldersInDeptSort->orderBy('created_at', 'desc')->paginate( 12);38 $folders = $foldersInDeptSort->orderBy('created_at', 'desc')->paginate(9); 39 39 } 40 40 else if ($request->query('sort') == 'name') { 41 $folders = $foldersInDeptSort->orderBy('name', 'asc')->paginate( 12);41 $folders = $foldersInDeptSort->orderBy('name', 'asc')->paginate(9); 42 42 } 43 43 else if ($request->query('sort') == 'no_of_files') { 44 $folders = $foldersInDeptSort->orderBy('no_of_files', 'desc')->paginate( 12);44 $folders = $foldersInDeptSort->orderBy('no_of_files', 'desc')->paginate(9); 45 45 } 46 46 else if($request->query('sort') == 'count'){ 47 47 $total = $foldersInDeptSort->folder->files->count(); 48 $folders = $foldersInDeptSort->orderBy($total, 'asc')->paginate( 12);48 $folders = $foldersInDeptSort->orderBy($total, 'asc')->paginate(9); 49 49 } 50 50 else { 51 $folders = Folder::where('department_id', $request->query('id'))->paginate( 12);51 $folders = Folder::where('department_id', $request->query('id'))->paginate(9); 52 52 } 53 53 } else { 54 54 if ($request->query('sort') == 'newest') { 55 $folders = Folder::orderBy('created_at', 'desc')->paginate( 12);55 $folders = Folder::orderBy('created_at', 'desc')->paginate(9); 56 56 } 57 57 else if ($request->query('sort') == 'name') { 58 $folders = Folder::orderBy('name', 'asc')->paginate( 12);58 $folders = Folder::orderBy('name', 'asc')->paginate(9); 59 59 } 60 60 else if ($request->query('sort') == 'no_of_files') { 61 $folders = Folder::orderBy('no_of_files', 'desc')->paginate( 12);61 $folders = Folder::orderBy('no_of_files', 'desc')->paginate(9); 62 62 } 63 63 else if ($request->query('sort') == 'recent') { 64 $folders = Folder::orderBy('created_at', 'desc')->paginate( 12);64 $folders = Folder::orderBy('created_at', 'desc')->paginate(9); 65 65 } else if ($request->query('search')) { 66 66 … … 73 73 $folders = $result; 74 74 } else { 75 $folders = Folder::paginate( 12);75 $folders = Folder::paginate(9); 76 76 } 77 77 } -
app/Http/Controllers/Dashboard/IndexController.php
r4d73966 r0a1fb54 32 32 return view("dashboard.index")->with([ 33 33 "counters" => $counters, 34 "largestDepartments" => Department::orderBy('no_of_folders', 'desc')->limit( 10)->get(),34 "largestDepartments" => Department::orderBy('no_of_folders', 'desc')->limit(5)->get(), 35 35 "folders" => Folder::all(), 36 36 "files" => File::all(), -
app/Http/Controllers/Dashboard/SettingsController.php
r4d73966 r0a1fb54 21 21 public function settings() 22 22 { 23 $fileType = FileType::find("1");24 25 23 return view("dashboard.settings.index")->with([ 26 24 "user" => auth()->user(), 27 "adminAndReferents" => User::where("role_id", 1)->orWhere("role_id", 2)->get(),28 25 "active_tab" => "account", 29 "fileType" => $fileType26 "fileType" => FileType::find("1") 30 27 ]); 31 28 } … … 38 35 $user->save(); 39 36 37 Alert::flash("Username updated successfully"); 38 40 39 auth()->logout(); 41 40 session()->flush(); 42 41 43 return redirect()->route("auth. loginShow");42 return redirect()->route("auth.showLogin"); 44 43 } 45 44 … … 51 50 $user->save(); 52 51 52 Alert::flash("Password updated successfully"); 53 53 54 auth()->logout(); 54 55 session()->flush(); 55 56 56 return redirect()->route("auth. loginShow");57 return redirect()->route("auth.showLogin"); 57 58 } 58 59 … … 71 72 $user->notify(new VerifyNewEmail($user)); 72 73 74 Alert::flash("Email updated successfully"); 75 73 76 auth()->logout(); 74 77 session()->flush(); 75 78 76 return redirect()->route("auth. loginShow");79 return redirect()->route("auth.showLogin"); 77 80 } 78 81 -
app/Http/Controllers/Dashboard/UsersController.php
r4d73966 r0a1fb54 27 27 return view("dashboard.users.index")->with([ 28 28 "users" => User::all(), 29 "roles" => Role::all(), 30 "adminAndReferents" => User::where("role_id", 1)->orWhere("role_id", 2)->get() 31 ]); 32 } 33 34 public function create() 35 { 36 return view("dashboard.users.create")->with([ 37 "roles" => Role::all(), 29 "roles" => Role::all() 38 30 ]); 39 31 } … … 77 69 } 78 70 79 public function editShow($id)80 {81 return view("dashboard.users.edit")->with([82 "user" => User::findOrFail($id),83 "roles" => Role::all(),84 ]);85 }86 87 71 public function edit(UpdateUserRequest $request, $id) 88 72 { … … 110 94 111 95 if($user->isDirty('email')) { 96 $user->is_active = false; 97 $user->security_code = $user->generateSecurityCode(); 98 $user->verify_token = $user->generateVerifyToken(); 112 99 $user->notify(new VerifyNewEmail($user)); 113 100 } 101 114 102 $user->save(); 115 103
Note:
See TracChangeset
for help on using the changeset viewer.