[exam] schedule

This commit is contained in:
xiaomlove
2021-04-29 19:18:13 +08:00
parent a1972ea288
commit 164bc80c4e
14 changed files with 315 additions and 92 deletions

View File

@@ -29,6 +29,17 @@ class ExamUser extends NexusModel
return self::$status[$this->status]['text'] ?? '';
}
public function getBeginAttribute()
{
return $this->begin ?? $this->exam->begin;
}
public function getEndAttribute()
{
return $this->end ?? $this->exam->end;
}
public function exam(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{
return $this->belongsTo(Exam::class, 'exam_id');

View File

@@ -2,6 +2,7 @@
namespace App\Models;
use App\Http\Middleware\Locale;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
@@ -117,6 +118,11 @@ class User extends Authenticatable
return true;
}
public function getLocaleAttribute()
{
return Locale::$languageMaps[$this->language->site_lang_folder] ?? 'en';
}
public function exams()
{