Esempio n. 1
0
 public function edit_user(SwcUserEditRequest $request)
 {
     $user = Member::find($request->id);
     $team = SwcTeam::find($request->team);
     if ($request->option == 'edit') {
         $user->display_name = $request->display_name;
         $user->save();
     }
     if ($request->option == 'delete') {
         $team->members()->detach($user);
     }
     return redirect(route('admin.swc.index'));
     // Redirect back to our index page
 }
Esempio n. 2
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Clan\Models\Event  $event
  * @param  \Clan\Http\Requests\Admin\Event\Update  $request
  * @return Response
  */
 public function update(Event $event, Requests\Admin\Event\Update $request)
 {
     $this->db->beginTransaction();
     try {
         $event->update($request->input());
         $event->members()->detach();
         foreach ($request->input('members') as $id => $member_id) {
             $member = Member::findOrFail($member_id);
             $event->members()->attach($member->id);
         }
     } catch (Exception $e) {
         $this->db->rollback();
         throw $e;
     }
     $this->db->commit();
     return redirect(route('admin.event.show', [$event->getKey()]))->with('successes', new MessageBag(['Successfully updated the event']));
 }
Esempio n. 3
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $members = Member::all();
     $time = Carbon::now()->second(0);
     $members->each(function ($member) use($time) {
         $results = $this->eoc->stats($member->display_name);
         if ($results === false) {
             return;
             // Skip to next member
         }
         $stats = ['created_at' => $time, 'updated_at' => $time];
         $this->api->getSkills()->each(function ($skill) use(&$stats, $results) {
             $stats[$skill->get('name') . '_rank'] = $results->get($skill->get('name'))->get('rank');
             $stats[$skill->get('name') . '_level'] = $results->get($skill->get('name'))->get('level');
             $stats[$skill->get('name') . '_xp'] = $results->get($skill->get('name'))->get('xp');
         });
         $member->stats()->create($stats);
     });
 }
Esempio n. 4
0
 public function rules()
 {
     $member = new Member();
     $unique = sprintf('unique:%s,%s', $member->getTable(), 'display_name');
     return ['display_name' => 'required|min:1|max:12|' . $unique, 'member_rank' => 'required'];
 }
Esempio n. 5
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  \Surreal\Hub\Models\Member  $member
  * @param  \Surreal\Hub\Http\Requests\Admin\Member\Destroy  $request
  * @return Response
  */
 public function destroy(Member $member, Requests\Admin\Member\Destroy $request)
 {
     if ((bool) $request->input('confirmation') !== true) {
         return redirect()->back()->withInput()->withErrors(new MessageBag(['Please confirm you wish to delete this member and all associated data']));
     }
     $member->delete();
     return redirect(route('admin.member.index'))->with('successes', new MessageBag(['Member successfully deleted']));
 }
Esempio n. 6
0
 public function members()
 {
     $d['members'] = Member::all();
     return view('site.members', $d);
 }
Esempio n. 7
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Clan\Models\PYPSeason  $season
  * @param  \Clan\Models\PYPTeam  $team
  * @param  \Clan\Http\Requests\Admin\PYP\Team\Update  $request
  * @return Response
  */
 public function update(SwcSeason $season, SwcCompetition $comp, Requests\Admin\Swc\Competition\Update $request)
 {
     $this->db->beginTransaction();
     try {
         $comp->update($request->input());
         $comp->members()->detach();
         foreach ($request->input('members') as $id => $member_id) {
             $member = Member::findOrFail($member_id);
             $comp->members()->attach($member->id);
         }
     } catch (Exception $e) {
         $this->db->rollback();
         throw $e;
     }
     $this->db->commit();
     return redirect(route('admin.swc.competition.show', [$season->getKey(), $comp->getKey()]))->with('successes', new MessageBag(['Successfully updates the competition']));
 }