generated from liutk/owl-admin-base
42 lines
964 B
PHP
42 lines
964 B
PHP
<?php
|
|
|
|
namespace App\Models\Train;
|
|
|
|
use App\Models\Employee;
|
|
use App\Traits\HasDateTimeFormatter;
|
|
use EloquentFilter\Filterable;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* 培训-试卷
|
|
*/
|
|
class Paper extends Model
|
|
{
|
|
use Filterable, HasDateTimeFormatter;
|
|
|
|
protected $table = 'train_examination_papers';
|
|
|
|
protected $fillable = ['examination_id', 'employee_id', 'content', 'mark', 'finished_at'];
|
|
|
|
protected $casts = [
|
|
// [{title: 题目, cate: 类型, options: 选项, score: 分值 , user_score: 得分, user_answer: 回答}]
|
|
'content' => 'json',
|
|
'finished_at' => 'datetime',
|
|
];
|
|
|
|
public function modelFilter()
|
|
{
|
|
return \App\Admin\Filters\TrianPaperFilter::class;
|
|
}
|
|
|
|
public function examination()
|
|
{
|
|
return $this->belongsTo(Examination::class, 'examination_id');
|
|
}
|
|
|
|
public function employee()
|
|
{
|
|
return $this->belongsTo(Employee::class, 'employee_id');
|
|
}
|
|
}
|