You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
willaengine/app/EmplResults.php

30 lines
702 B

<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class EmplResults extends Model
{
protected $fillable = [
'question_id' , 'result' , 'user_id'
];
public function getResultAttribute()
{
return json_decode($this->attributes['result']);
}
public function setResultAttribute($value)
{
$this->attributes['result'] = json_encode($value, JSON_UNESCAPED_UNICODE);
}
public function Question()
{
return $this->belongsTo('App\EmplQuestion','question_id');
}
public function User()
{
return $this->belongsTo('App\User','user_id')->select(['name','id','detail','birthday','cell_number','email']);
}
}