Пример #1
0
 /**
  * @param Companionship $companionship
  * @param Family $family
  * @param Elder $elder
  * @param $id
  * @return $this
  */
 public function edit(Companionship $companionship, Family $family, Elder $elder, $id)
 {
     $companionship = $companionship->getCompanionship($id);
     $families = $family->getFamilies();
     $elders = $elder->getElders();
     return view('companionships.edit')->with(compact('companionship', 'families', 'elders'));
 }
Пример #2
0
 /**
  * @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']]);
 }
Пример #3
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     // Setup the things that can't be setup in the constructor (??)
     $this->setup('csv.elders_csv_path');
     // Only static constructors. Fine, fine.
     $elders = Reader::createFromPath($this->path);
     $elders = $elders->fetchAssoc();
     $count = 0;
     foreach ($elders as $row) {
         $this->elder->create(['name' => $this->nameFlip($row['NAME']), 'priesthood' => $row['PRIESTHOOD'], 'endowed' => $row['ENDOWED'] === 'Yes' ? true : false, 'age' => intval($row['AGE']), 'birth_date' => Carbon::createFromFormat('j M Y', $row['BIRTH DATE']), 'phone' => $row['PHONE NUMBER'], 'email' => $row['E-MAIL']]);
         $count++;
     }
     $this->info('All done. ' . $count . ' records were imported into the database.');
 }
Пример #4
0
 /**
  * @param Elder $elder
  * @param $id
  */
 public function destroy(Elder $elder, $id)
 {
     $elder->destroy($id);
 }