public function putType($id) { $type = \Input::get('type') . 's'; $acc = \App\Accomplishment::find($id); if ($acc) { $acc->{$type} = $acc->{$type} + 1; $acc->save(); return $acc; } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($project_id, $id) { $accomplishment = Accomplishment::find($id); $accomplishment->delete(); flash()->success('Accomplishment has been successfully deleted!'); return redirect()->action('ProjectsController@show', $project_id); }
/** * Run the database seeds. * * @return void */ public function run() { \App\Accomplishment::create(['description' => 'Woke up at 8:45 this morning!', 'date' => '1443089400000', 'coffees' => 13, 'beers' => 1, 'user_id' => \App\User::where('username', 'petar')->first()->id]); \App\Accomplishment::create(['description' => 'Programmed for 8 hours straight :O', 'date' => '1443049884406', 'coffees' => 9, 'beers' => 8, 'user_id' => \App\User::where('username', 'aca')->first()->id]); \App\Accomplishment::create(['description' => 'Read a book', 'date' => '1443003000000', 'coffees' => 3, 'beers' => 4, 'user_id' => \App\User::where('username', 'aca')->first()->id]); }
public function generate($id) { ini_set("max_execution_time", 0); $project = Project::find($id); $accomplishments = Accomplishment::where('project_id', $id)->get(); $actions = Action::where('project_id', $id)->get(); $expenses = Expense::where('project_id', $id)->get(); $issues = Issue::where('project_id', $id)->get(); $milestones = Milestone::where('project_id', $id)->get(); $risks = Risk::where('project_id', $id)->get(); $lastUser = $project->users->last(); return view('projects.generate', compact('project', 'actions', 'accomplishments', 'expenses', 'issues', 'milestones', 'risks', 'lastUser')); }
public function generate() { ini_set("max_execution_time", 0); if (Auth::user()->role == "Project Manager") { $activities = Activity::whereIn('action', array('Created', 'Deleted', 'Updated'))->where(function ($query) { return $query->where('action', '!=', 'Created')->orWhere('type', '!=', 'Deliverable'); })->where('user_id', Auth::user()->id)->get(); $projects = Project::where('user_id', Auth::user()->id)->get(); $projectids = array_pluck($projects, 'id'); $milestones = Milestone::whereIn('project_id', $projectids)->get(); $accomplishments = Accomplishment::whereIn('project_id', $projectids)->get(); $issues = Issue::whereIn('project_id', $projectids)->get(); $risks = Risk::whereIn('project_id', $projectids)->get(); $expenses = Expense::whereIn('project_id', $projectids)->get(); $actions = Action::whereIn('project_id', $projectids)->get(); $deliverables = Deliverable::whereIn('project_id', $projectids)->get(); $business_project_team_members = BusinessProjectTeamMember::whereIn('project_id', $projectids)->get(); $technical_project_team_members = TechnicalProjectTeamMember::whereIn('project_id', $projectids)->get(); $support_team_members = SupportTeamMember::whereIn('project_id', $projectids)->get(); return view('audit.generate', compact('activities', 'projects', 'milestones', 'accomplishments', 'issues', 'risks', 'expenses', 'actions', 'deliverables', 'business_project_team_members', 'technical_project_team_members', 'support_team_members')); } elseif (Auth::user()->role == "System Administrator") { $activities = Activity::whereIn('action', array('Created', 'Deleted', 'Updated'))->where(function ($query) { return $query->where('action', '!=', 'Created')->orWhere('type', '!=', 'Deliverable'); })->get(); $projects = Project::all(); $milestones = Milestone::all(); $accomplishments = Accomplishment::all(); $issues = Issue::all(); $risks = Risk::all(); $users = User::all(); $expenses = Expense::all(); $actions = Action::all(); $deliverables = Deliverable::all(); $business_project_team_members = BusinessProjectTeamMember::all(); $technical_project_team_members = TechnicalProjectTeamMember::all(); $support_team_members = SupportTeamMember::all(); return view('audit.generate', compact('activities', 'projects', 'milestones', 'accomplishments', 'issues', 'risks', 'users', 'expenses', 'actions', 'deliverables', 'business_project_team_members', 'technical_project_team_members', 'support_team_members')); } else { flash()->error('You are not authorized to proceed.'); return redirect()->action('ProjectsController@index'); } }