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.
35 lines
574 B
35 lines
574 B
<?php
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
class CourseKeep extends SoftDeletesModel
|
|
{
|
|
|
|
protected $appends = ['status_text'];
|
|
public static $intToString = [
|
|
'status' => [
|
|
0 => '缺勤',
|
|
1 => '出勤'
|
|
]
|
|
];
|
|
|
|
public function getStatusTextAttribute()
|
|
{
|
|
return self::$intToString['status'][$this->status];
|
|
}
|
|
|
|
public function course()
|
|
{
|
|
return $this->hasOne(Course::class, 'id', 'course_id');
|
|
}
|
|
|
|
public function user()
|
|
{
|
|
return $this->hasOne(User::class, 'id', 'user_id');
|
|
}
|
|
|
|
}
|
|
|