/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $deleteChecked = Input::get('demand'); if ($deleteChecked) { if (Auth::user()->type == 3 || Auth::user()->loginas == 3) { foreach ($deleteChecked as $delete) { $insert = new Demanddelete(); $insert->userId = Auth::user()->id; $insert->demandId = $delete; $insert->save(); } Session::flash('message', 'Demand deleted Successfully'); return Redirect::to('demand_view'); } else { foreach ($deleteChecked as $delete) { $memdel = DB::table('demand')->whereId($delete)->update(['status' => 0]); } Session::flash('message', 'Demand deleted Successfully'); return Redirect::to('demand'); } } if ($id != 0) { if (Auth::user()->type == 3 || Auth::user()->loginas == 3) { $insert = new Demanddelete(); $insert->userId = Auth::user()->id; $insert->demandId = $id; $insert->save(); Session::flash('message', 'Demand deleted Successfully'); return Redirect::to('demand_view'); } else { $memdel = DB::table('demand')->whereId($id)->update(['status' => 0]); Session::flash('message', 'Demand deleted Successfully'); return Redirect::to('demand'); } } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $deleteChecked = Input::get('demand'); if ($deleteChecked) { if (Auth::user()->type == 3 || Auth::user()->loginas == 3) { foreach ($deleteChecked as $delete) { $insert = new Demanddelete(); $insert->userId = Auth::user()->id; $insert->demandId = $delete; $insert->save(); } return Redirect::to('demand_view'); } else { foreach ($deleteChecked as $delete) { $memdel = DB::table('demand')->whereId($delete)->delete(); } return Redirect::to('demand'); } } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $deleteChecked = Input::get('demand'); if ($deleteChecked) { if (Auth::user()->type == 3 || Auth::user()->loginas == 3) { foreach ($deleteChecked as $delete) { $insert = new Demanddelete(); $insert->userId = Auth::user()->id; $insert->demandId = $delete; $insert->save(); } $history = new History(); $history->action_id = 0; $history->action = 'Demand deleted'; $history->user = Auth::user()->name; $history->remark = 'Number of demand deleted=' . count($deleteChecked); $history->save(); Session::flash('message', 'Demand deleted Successfully'); return Redirect::to('demand_view'); } else { foreach ($deleteChecked as $delete) { $memdel = DB::table('demand')->whereId($delete)->delete(); } $history = new History(); $history->action_id = 0; $history->action = 'Demand deleted'; $history->user = Auth::user()->name; $history->remark = 'Number of demand deleted=' . count($deleteChecked); $history->save(); Session::flash('message', 'Demand deleted Successfully'); return Redirect::to('demand'); } } }