File manager - Edit - /home/autoph/public_html/projects/aha-api/app/Models/SurveySection.php
Back
<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; use OwenIt\Auditing\Contracts\Auditable; use Illuminate\Database\Eloquent\SoftDeletes; use OwenIt\Auditing\Auditable as AuditableTrait; use Illuminate\Database\Eloquent\Factories\HasFactory; class SurveySection extends Model implements Auditable { use HasFactory, SoftDeletes, AuditableTrait; /** * The attributes that are NOT mass assignable. * */ protected $guarded = ['deleted_at']; /** * The attributes that should be cast. * * @var array<string, string> */ protected $casts = []; protected $appends = ['survey_name']; /** * The survey section belongs to. * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function survey() { return $this->belongsTo(Survey::class); } /** * The questions of the section. * * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function questions() { return $this->hasMany(SurveyQuestion::class, 'section_id'); } public function getSurveyNameAttribute() { return Survey::withTrashed()->find($this->survey_id)->name; } }
| ver. 1.4 |
.
| PHP 8.1.32 | Generation time: 0.23 |
proxy
|
phpinfo
|
Settings