Exemplo n.º 1
0
 public function send_contract_new_mod($forum_user_id, $contract_id)
 {
     $contract = SyndieContract::find($contract_id);
     $forum_user = ForumUserModel::find($forum_user_id);
     $from_name = config('aurora.syndie_contract_from_name');
     $from_address = config('aurora.syndie_contract_from_address');
     //Get user E-Mail
     Mail::send('emails.contract_new_mod', ['forum_user' => $forum_user, 'contract' => $contract], function ($m) use($forum_user, $contract, $from_name, $from_address) {
         $m->from($from_address, $from_name);
         $m->to($forum_user->user_email, $forum_user->username);
         $m->subject('Contract Update - ' . $contract->title);
     });
 }
 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 unsubscribe($contract, Request $request)
 {
     $SyndieContract = SyndieContract::findOrfail($contract);
     $SyndieContract->remove_subscribers($request->user()->user_id);
     Log::notice('perm.contracts.unsubscribe - User Unsubscribed from Contract', ['user_id' => $request->user()->user_id, 'contract_id' => $SyndieContract->contract_id]);
     return redirect()->route('syndie.contracts.show', ['contract' => $contract]);
 }
 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]);
 }