mirror of
https://github.com/robonen/education-project.git
synced 2026-03-20 02:44:31 +00:00
модуль Задания(почти готов)
This commit is contained in:
14
app/Models/AnswerToTask.php
Normal file
14
app/Models/AnswerToTask.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AnswerToTask extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'answers_to_task';
|
||||
protected $fillable = ['description', 'student_id', 'task_id', 'class_id', 'checked', 'mark', 'comment_by_teacher'];
|
||||
}
|
||||
@@ -26,4 +26,8 @@ class SchoolClass extends Model
|
||||
->withPivot('hours_per_week', 'hours_per_year');
|
||||
}
|
||||
|
||||
public function tasks() {
|
||||
return $this->hasMany(Task::class, 'class_id');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,18 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class Task extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $fillable = ['name', 'description', 'deadline', 'teacher_id', 'subject_id'];
|
||||
|
||||
public function banktask() {
|
||||
return $this->hasMany(BankTask::class, 'class_task');
|
||||
}
|
||||
|
||||
public function teacher(){
|
||||
return $this->belongsTo(Teacher::class);
|
||||
}
|
||||
|
||||
public function class() {
|
||||
$this->belongsTo(SchoolClass::class);
|
||||
}
|
||||
|
||||
protected $table = 'tasks';
|
||||
}
|
||||
|
||||
13
app/Models/TaskFile.php
Normal file
13
app/Models/TaskFile.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TaskFile extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'task_files';
|
||||
protected $fillable = ['name', 'type', 'extension', 'url', 'task_id'];
|
||||
}
|
||||
15
app/Models/TaskHistory.php
Normal file
15
app/Models/TaskHistory.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TaskHistory extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'banktask_task';
|
||||
protected $fillable = ['banktask_id', 'task_id'];
|
||||
public $timestamps = false;
|
||||
}
|
||||
@@ -24,4 +24,7 @@ class Teacher extends Model
|
||||
return $this->hasMany(Timetable::class);
|
||||
}
|
||||
|
||||
public function tasks(){
|
||||
return $this->hasMany(Task::class);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user