protected static function boot() { // TODO send email with randomly generated password Student::created(function ($student) { $student->university->user()->create(['name' => $student->first_name . ' ' . $student->last_name, 'email' => $student->email, 'password' => bcrypt('1234'), 'role' => 'student']); }); }