- Timestamp:
- 10/17/21 20:28:35 (3 years ago)
- Branches:
- develop, master
- Children:
- e6c1f87
- Parents:
- d795fa6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
app/Http/Controllers/Dashboard/DocumentsController.php
rd795fa6 rbd9e8e3 17 17 public function index(Request $request) 18 18 { 19 if($request->department) { 20 $documents = Document::with('department')->where('department', function ($query) { 21 $query->where('id', $request->department)->get(); 22 }); 23 } 24 else{ 19 if ($request->query('id')) { 20 $documents = Document::where('department_id', $request->query('id'))->get(); 21 } else { 25 22 $documents = Document::all(); 26 23 } … … 68 65 $document->arch_id = $request->arch_id; 69 66 $document->description = $request->description; 70 $document->updated_at = $request->Carbon::now();;71 67 72 68 $document->save(); … … 90 86 $document->description = $request->description; 91 87 92 if (!Storage::disk('local')->has($document->department()->pluck('location')->join("") . '/' . $request->arch_id)){88 if (!Storage::disk('local')->has($document->department()->pluck('location')->join("") . '/' . $request->arch_id)) { 93 89 Storage::disk('local')->makeDirectory($document->department()->pluck('location')->join("") . '/' . $request->arch_id); 94 90 } … … 106 102 } 107 103 108 104 Alert::flash("New document created successfully"); 109 105 110 106 return redirect()->route("dashboard.documents.index");
Note:
See TracChangeset
for help on using the changeset viewer.