Ejemplo n.º 1
0
 /**
  * Store a new member
  *
  * @param $inputs
  *
  * @return static
  */
 protected function storeNewMember($inputs)
 {
     $member = Member::cleanMemberInputs(Member::create($inputs));
     if (isset($inputs['team_id'])) {
         $member->teamInterests()->attach($inputs['team_id']);
     }
     return $member;
 }
Ejemplo n.º 2
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param Team $team
  *
  * @return Response
  */
 public function edit(Team $team)
 {
     $member_list = Member::memberDropdown(FALSE);
     return view('team.edit', compact('team', 'member_list'));
 }
Ejemplo n.º 3
0
 /**
  * Process the ID Card Form
  *
  * @return \Illuminate\View\View
  */
 public function importStore()
 {
     if (!empty(Request::input('member_id'))) {
         foreach (Request::input('member_id') as $member_id) {
             $member = Member::find($member_id)->load('idcard');
             if ($member->idcard->isEmpty()) {
                 $idcard = PrintList::create(['member_id' => $member->id]);
             } else {
                 $idcard = $member->idcard[0];
             }
             $idcard->reprint();
             $idcard->printed();
         }
         flash()->success('Added ' . count(Request::input('member_id')) . ' ID Cards successfully!');
     }
     return redirect(url('idcard/import'));
 }
Ejemplo n.º 4
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param StudyGroup $group
  *
  * @return Response
  */
 public function edit(StudyGroup $group)
 {
     $district_list = District::districtDropdown();
     $member_list = Member::memberDropdown(true);
     return view('study_group.edit', compact('district_list', 'member_list', 'group'));
 }
Ejemplo n.º 5
0
 /**
  * This takes the member parameters and cleans them.
  *
  * @param Member $member
  *
  * @return Member
  */
 public static function cleanMemberInputs(Member $member)
 {
     if (filter_var($member->email, FILTER_VALIDATE_EMAIL)) {
         //Valid Email
         $email = trim($member->email);
     } else {
         //Invalid
         $email = null;
     }
     if (!empty($member->mobile)) {
         $mobile = trim(preg_replace("/[^0-9,.]/", "", $member->mobile));
     } else {
         $mobile = null;
     }
     $member->update(['first_name' => ucwords($member->first_name), 'last_name' => ucwords($member->last_name), 'email' => $email, 'mobile' => $mobile]);
     return $member;
 }
Ejemplo n.º 6
0
 /**
  * This method loops through a member_list (array of member ids) and add the
  * provided family.
  *
  * @param Family $family
  * @param array  $member_list
  *
  * @return bool
  */
 private function addMembersToFamily(Family $family, array $member_list)
 {
     foreach ($member_list as $member_id) {
         if ($member = Member::find($member_id)) {
             $member->update(['family_id' => $family->id]);
         }
     }
     return true;
 }