public function update(Request $request, $id) { // Start Check Authorization $invalid_auth = 1; $authRole = Auth::user()->UserRoles->role; if ($authRole == 1 or $authRole == 3) { $invalid_auth = 0; } if ($invalid_auth == 1) { Alert::error('Anda tidak memilik akses ini')->persistent('close'); return redirect('dashboard'); } // End Check Authorization // Validation // $validation = Validator::make($request->all(), MemberCat::rules($id)); // Check if it fails // if ($validation->fails()) { Alert::error('Terjadi kesalahan!')->persistent("Close"); return redirect()->back()->withInput()->with('errors', $validation->errors()); } $mc = MemberCat::find($id); $mc->name = $request->input('name'); $mc->save(); Alert::success('Berhasil merubah, ' . $request->input('name') . ' !')->persistent("Close"); return redirect('member_cat/list')->with('message', 'Berhasil edit !'); }
public function HireMember($id, $id_stores, $mc) { $projects = Project::find($id); $stores = Store::find($id_stores); $mc = MemberCat::find($mc); $data = Employee::all(); return View('dropmin/project/hiremember')->with('data', $data)->with('project', $projects)->with('stores', $stores)->with('mc', $mc); }
public function HireMember($id, $id_stores, $mc) { // Start Check Authorization /** * 1. FullAccess - 1 * 2. HRD - 3 * 3. Creator - 5 * 4. Handler - 7 */ $invalid_auth = 1; $authRole = Auth::user()->UserRoles->role; if ($authRole == 7 or $authRole == 1 or $authRole == 3) { $invalid_auth = 0; } if ($invalid_auth == 1) { Alert::error('Anda tidak memilik akses ini')->persistent('close'); return redirect('project/view/' . $id); } // End Check Authorization $projects = Project::find($id); $stores = Store::find($id_stores); $mc = MemberCat::find($mc); $data = Employee::all(); return View('dropmin/project/hiremember')->with('datas', $data)->with('project', $projects)->with('stores', $stores)->with('mc', $mc); }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { // Validation // $validation = Validator::make($request->all(), MemberCat::rules($id)); // Check if it fails // if ($validation->fails()) { Alert::error('Terjadi kesalahan!')->persistent("Close"); return redirect()->back()->withInput()->with('errors', $validation->errors()); } $mc = MemberCat::find($id); $mc->name = $request->input('name'); $mc->save(); Alert::success('Berhasil merubah, ' . $request->input('name') . ' !')->persistent("Close"); return redirect('member_cat/list')->with('message', 'Berhasil edit !'); }