addDomain($school, $domain); } public function addDomain(School $school, string $domain): void { if (! School::where('id', $school->id)->exists()) { throw new AuditionAdminException('School does not exist'); } if (SchoolEmailDomain::where('domain', $domain)->where('school_id', $school->id)->exists()) { return; } SchoolEmailDomain::create([ 'domain' => $domain, 'school_id' => $school->id, ]); $message = 'Added the email domain '.$domain.' to school '.$school->name; $affected = ['schools' => [$school->id]]; auditionLog($message, $affected); } }