'json', ]; /** * @return BelongsTo */ public function form(): BelongsTo { return $this->belongsTo(Form::class); } /** * @return HasMany */ public function children(): HasMany { return $this->hasMany(self::class, 'parent_id'); } /** * @param Builder $query * @return Builder */ public function scopeWithFilter(Builder $query, ParticipantFilterScope $filter): Builder { return $filter->apply($query); } public function getFields(): FieldCollection { return FieldCollection::fromRequest($this->form, $this->data); } public function sendConfirmationMail(): void { if (!$this->getFields()->getMailRecipient()) { return; } Mail::to($this->getFields()->getMailRecipient())->queue(new ConfirmRegistrationMail()); } }