public function createAddress(array $attributes, $studentId) { $address = null; $student = $this->findStudent($studentId); $attributes['user_id'] = $student->user->id; $attributes['is_emergency'] = isset($attributes['is_emergency']); DB::transaction(function () use($attributes, &$address) { $address = Address::create($attributes); }); return $address; }
public function createAddress(array $attributes, $guardianId) { $address = null; $guardian = $this->findGuardian($guardianId); $attributes['user_id'] = $guardian->user->id; $attributes['is_emergency'] = isset($attributes['is_emergency']); DB::transaction(function () use($attributes, &$address) { $address = Address::create($attributes); }); return $address; }
public function createAddress(array $attributes, $employeeId) { $address = null; $employee = $this->findEmployee($employeeId); $attributes['user_id'] = $employee->user->id; $attributes['is_emergency'] = isset($attributes['is_emergency']); DB::transaction(function () use($attributes, &$address) { $address = Address::create($attributes); }); return $address; }