/**
  * @param $comp
  */
 private function addCompanionship($comp)
 {
     $seniorName = $this->nameFlip($comp['HT 1']);
     $juniorName = $this->nameFlip($comp['HT 2']);
     $senior = $this->elder->where('name', $seniorName)->first();
     $junior = $this->elder->where('name', $juniorName)->first();
     $junior_id = $junior instanceof Elder ? $junior->id : null;
     $this->companionship->create(['senior' => $senior->id, 'junior' => $junior_id, 'district' => $comp['District']]);
 }
 /**
  * @param Companionship $companionship
  * @param $id
  */
 public function destroy(Companionship $companionship, $id)
 {
     $companionship->destroy($id);
 }
Example #3
0
 /**
  * @param Family $family
  * @param Companionship $companionship
  * @param $id
  * @return $this
  */
 public function edit(Family $family, Companionship $companionship, $id)
 {
     $family = $family->getFamily($id);
     $companionships = $companionship->all();
     return view('families.edit')->with(compact('family', 'companionships'));
 }