/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $matObj = new Material(); $material = $matObj->find($id); $materialCategories = MaterialCategory::all(); $materialCategId = MaterialCategory::find($material->material_categ_id); $moduleId = 4; //material //get the image assiociates $matFiles = Files::where('attachment_id', $material->id)->where('is_active', True)->where('module_id', $moduleId)->get(); return view('pages.admin.material.edit', ['material' => $material, 'materialCategories' => $materialCategories, 'materialCategId' => $materialCategId, 'matFiles' => $matFiles, 'moduleId' => $moduleId]); }