initial commit
This commit is contained in:
27
app/Models/ProfileSubQuestion.php
Normal file
27
app/Models/ProfileSubQuestion.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProfileSubQuestion extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $fillable = ['category_id', 'question_id', 'question', 'parent_sub_question_id', 'sub_question_type', 'sub_question_options'];
|
||||
public function getSubQuestionOptionsAttribute($value)
|
||||
{
|
||||
|
||||
return unserialize($value);
|
||||
}
|
||||
|
||||
public function subQuestions()
|
||||
{
|
||||
return $this->hasMany(ProfileSubQuestion::class, 'parent_sub_question_id', 'id');
|
||||
}
|
||||
|
||||
public function parentQuestion()
|
||||
{
|
||||
return $this->belongsTo(ProfileSubQuestion::class, 'parent_sub_question_id');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user