public function groups() { $bp = BusinessPlan::all(); $bpid = count($bp); $groups = Group::all(); $tasks = array(); $actions = array(); foreach (BusinessPlan::all() as $x) { array_push($tasks, DB::select("select t.* from tasks t, actions a, objectives o, goals g, business_plans b where t.action_id = a.id and a.objective_id = o.id and o.goal_id = g.id and g.bpid = b.id and b.id = {$x->id}")); array_push($actions, DB::select("select a.* from actions a, objectives o, goals g, business_plans b where a.objective_id = o.id and o.goal_id = g.id and g.bpid = b.id and b.id = {$x->id}")); } $users = User::all(); $rosters = Roster::all(); $businessPlans = BusinessPlan::lists('name', 'id'); return view('groups', compact('groups', 'actions', 'tasks', 'users', 'rosters', 'businessPlans', 'bpid')); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { Department::create($request->input()); foreach (BusinessPlan::lists('id') as $bid) { $newGoal = new Goat(); $newGoal->type = 'G'; $newGoal->parent_id = null; $newGoal->description = $request['name'] . " Goals"; $newGoal->priority = 0; $newGoal->complete = false; $newGoal->goal_type = 'D'; $newGoal->due_date = null; $newGoal->budget = 0; $newGoal->bid = $bid; $newGoal->save(); } return redirect('admin/depts'); }
public function editGoal($idbp, $id) { //$bp = BusinessPlan::findOrFail($idbp); $goal = Goal::findOrFail($id); $groups = Group::lists('name'); $bp = BusinessPlan::lists('name'); return view('businessPlan.editGoal', compact('goal', 'groups', 'bp', 'idbp')); }