public function updateRoles(Request $request) { // dd($request->user_id); // dd($request->role); $updateRole = \CrudHelper::show(new \App\User(), 'id', $request->user_id)->first(); $updateRole->roles()->sync([$request->role]); return redirect()->route('admin')->with('success_message', 'Role for' . $updateRole['name'] . ' has been updated...'); }
public function buildOrder($products) { $orderAmount = 0; foreach ($products as $productKey => $productValue) { $getProduct[] = \CrudHelper::show(new \App\Product(), 'id', $productValue, ['images'])->first()->toArray(); unset($getProduct[$productKey]['created_at']); unset($getProduct[$productKey]['updated_at']); unset($getProduct[$productKey]['description']); $orderAmount = $orderAmount + $getProduct[$productKey]['price']; } $orderDetails = ['products' => $getProduct, 'orderAmount' => $orderAmount]; return $orderDetails; }
public function getLoan($id) { $loan = \CrudHelper::show(new \App\Loan(), 'id', $id); return $loan; }