get(); return view('admin.designation.index',$data); } public function create() { $data['title'] = "Designation Create"; return view('admin.designation.add',$data); } public function store(Request $request) { $this->validate($request,[ 'name' => 'required' ]); $user_id = \Auth::user()->id; $designation = new Designation; $designation->name = $request->name; $designation->added_by = $user_id; $designation->status = 1; $designation->save(); return redirect('admin/designation')->with('msg','Data Insert Successful!'); } public function edit($id) { $data['title'] = "Designation Edit"; $data['designation'] = Designation::find($id); return view('admin.designation.edit',$data); } public function update(Request $request, $id) { $this->validate($request,[ 'name' => 'required' ]); $user_id = \Auth::user()->id; $designation_u = Designation::find($id); $designation_u->name = $request->name; $designation_u->updated_by = $user_id; $designation_u->save(); return redirect('admin/designation')->with('msg','Data Update Successful!'); } public function destroy($id) { Designation::whereId($id)->delete(); return redirect('admin/designation')->with('msg','Successfully Deleted!'); } public function statusUpdate($id) { $user_id = \Auth::user()->id; $designation_info = Designation::find($id); if($designation_info->status == 0){ $designation_info->status = 1; $status = 'published'; }else{ $designation_info->status = 0; $status = 'unpublished'; } $designation_info->update(); } }