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]);
 }
 private function createCompletionComment(SyndieContractComment $comment, SyndieContract $contract, $objectives, $type = "confirmopen")
 {
     $system_comment = new SyndieContractComment();
     $system_comment->contract_id = $comment->contract_id;
     $system_comment->commentor_id = 0;
     $system_comment->commentor_name = "System";
     $system_comment->title = "Contract Completion";
     $system_comment->type = "ic";
     switch ($type) {
         case "confirmopen":
             $system_comment->comment = "#### Completion Report Approved\nThe Completion-Report with the title {$comment->title} by {$comment->commentor_name} has been **approved** by the contract author.\n\nThe contract has been left open.\n";
             break;
         case "confirmclose":
             $system_comment->comment = "#### Completion Report Approved\nThe Completion-Report with the title {$comment->title} by {$comment->commentor_name} has been **approved** by the contract author.\n\nThe contract has been closed.\n";
             break;
         case "reject":
             $system_comment->comment = "#### Completion Report Approved\nThe Completion-Report with the title {$comment->title} by {$comment->commentor_name} has been **rejected** the contract author.\n";
             break;
     }
     if ($type == "confirmopen" || $type == "confirmclose") {
         $system_comment->comment .= "The following payment has been transferred to the contractor:";
         $system_comment->comment .= "\n* Base Reward: " . $contract->reward_other;
         foreach ($objectives as $objective) {
             $system_comment->comment .= "\n* Objective Reward - \"" . $objective->title . "\": " . $objective->reward_other;
         }
     }
     $system_comment->save();
 }