public static function loadFormEdit($params, $currentUser, $con) { // check role's permission $permission = RolePermissionQuery::create()->select('update_stock')->findOneById($currentUser->role_id, $con); if (!$permission || $permission != 1) { throw new \Exception('Akses ditolak. Anda tidak mempunyai izin untuk melakukan operasi ini.'); } $stock = Stocks::seeker($params, $currentUser, $con); $results['success'] = true; $results['data'] = $stock['data']; return $results; }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit() { $stock = Stocks::where('id', $_POST['id'])->get()->toArray(); return view('auth.stock.edit', compact('stock')); }