function userSection() { $userId = Session::get('userId'); if (!isset($userId)) { return Redirect::to('/'); } $runningProjects = Project::where('status', '=', 'active')->count(); $closedProjects = Project::where('status', '=', 'closed')->count(); $currentBugs = Bug::where('status', '=', 'active')->count(); $fixedBugs = Bug::where('status', '=', 'fixed')->count(); $unresolvedBugs = Bug::where('status', '=', 'unresolved')->count(); $userBugs = BugUser::where('user_id', '=', $userId)->where('status', '=', 'active')->with('bug')->with('bug.project')->get(); return View::make('users.user-section')->with('runningProjects', $runningProjects)->with('closedProjects', $closedProjects)->with('currentBugs', $currentBugs)->with('fixedBugs', $fixedBugs)->with('unresolvedBugs', $unresolvedBugs)->with('userBugs', $userBugs); }
function changeBugStatus() { $userId = Session::get('userId'); if (!isset($userId)) { return "not logged"; } $id = Input::get('id'); $bug = Bug::find($id); if ($bug) { $status = Input::get('status'); if (isset($status)) { $bug->status = Input::get('status'); $bug->save(); BugUser::where('bug_id', '=', $bug->id)->update(['status' => $bug->status]); echo 'done'; } else { echo 'invalid'; } } else { echo 'invalid'; } }