public function delete(Request $request) { $this->validate($request, ['solution_id' => 'required|numeric']); $solution_id = $request->input('solution_id'); $solution = Solution::where('id', $solution_id)->where('deleted', false)->where('user_id', Auth::user()->id)->first(); if (!$solution) { abort(404); } $solution->deleted = true; $pass = $solution->save(); $this->clearCache($solution); if ($pass) { Alert::setSuccessAlert(Lang::get('app.deleted_solution')); } else { Log::alert(__METHOD__ . '(' . __FILE__ . ')', array('solution_id' => $solution->id, 'user_id' => Auth::user()->id)); Alert::setErrorAlert(Lang::get('app.unknown_error')); } Statistic::SubSolution(); return redirect()->action('UserController@solutions'); }