public function show($contract)
 {
     $contract = SyndieContract::findOrFail($contract);
     $comments = SyndieContractComment::where('contract_id', '=', $contract->contract_id)->get();
     $objectives = SyndieContractObjective::where('contract_id', '=', $contract->contract_id)->get();
     return view('syndie.contract.view', ['contract' => $contract, 'objectives' => $objectives, 'comments' => $comments]);
 }
 public function postAdd(Request $request, $contract)
 {
     $contract = SyndieContract::findOrFail($contract);
     if ($request->user()->cannot('syndie_contract_moderate') && $contract->contractee_id != $request->user()->id) {
         abort('403', 'You do not have the required permission');
     }
     $this->validate($request, ['title' => 'required', 'description' => 'required', 'reward' => 'required']);
     $objective = new SyndieContractObjective();
     $objective->contract_id = $contract->contract_id;
     $objective->status = "open";
     $objective->title = $request->input('title');
     $objective->description = $request->input('description');
     //$objective->reward_credits = $request->input('reward');
     $objective->reward_other = $request->input('reward');
     $objective->save();
     Log::notice('perm.syndie.objective.add - Contract Objective has been added', ['user_id' => $request->user()->user_id, 'objective_id' => $objective->objective_id]);
     return redirect()->route('syndie.contracts.show', ['contract' => $objective->contract_id]);
 }
 public function reject(Request $request, $comment)
 {
     $comment = SyndieContractComment::findOrFail($comment);
     $contract = SyndieContract::findOrFail($comment->contract_id);
     $objectives = $comment->objectives()->get();
     if ($request->user()->cannot('syndie_contract_moderate') && $contract->contractee_id != $request->user()->id) {
         abort('403', 'You do not have the required permission');
     }
     $comment->report_status = 'rejected';
     $comment->save();
     $this->createCompletionComment($comment, $contract, $objectives, "reject");
     Log::notice('perm.syndie.contractcomment.reject - Contract Comment has been rejected', ['user_id' => $request->user()->user_id, 'comment_id' => $comment->comment_id]);
     return redirect()->route('syndie.contracts.show', ['contract' => $comment->contract_id]);
 }