/** * Execute the job. * * @param UserRepository $repository * @return void */ public function handle(UserRepository $repository) { $person = User::addHouseholdMember($this->firstname, $this->lastname, $this->middleinitial, $this->gender, $this->mobile_no, $this->email); $repository->save($person); $member = HouseholdMember::addMember($this->household_id, $person->id); $household = Household::findOrFail($this->household_id); $household->members()->save($member); event(new UserHasRegistered($person)); }
public function getHouseholdMembers($exceptId) { return HouseholdMember::with('user')->where('household_id', $this->id)->where('user_id', '!=', $exceptId)->get(); }