1
0
mirror of https://github.com/robonen/education-project.git synced 2026-03-20 02:44:31 +00:00

Модуль журнала

This commit is contained in:
2020-12-16 05:22:28 +07:00
parent 2e2942e42c
commit be8af67c61
21 changed files with 868 additions and 22 deletions

View File

@@ -9,7 +9,7 @@ class HeadTeacher extends Model
{
use HasFactory;
protected $guarded = [
protected $fillable = [
'user_id',
];

22
app/Models/Journal.php Normal file
View File

@@ -0,0 +1,22 @@
<?php
namespace App\Models;
use App\Filters\QueryFilter;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Journal extends Model
{
use HasFactory;
protected $fillable = [
'teacher_id',
'student_id',
'subject_id',
'score',
'comment',
'updated_at',
];
}

View File

@@ -10,7 +10,7 @@ class Parentt extends Model
{
use HasFactory;
protected $guarded = [
protected $fillable = [
'user_id',
];

View File

@@ -25,5 +25,4 @@ class SchoolClass extends Model
return $this->belongsToMany(Subject::class, 'academic_plans', 'class_id')
->withPivot('hours_per_week', 'hours_per_year');
}
}

View File

@@ -2,6 +2,7 @@
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Validator;
@@ -10,14 +11,21 @@ class Student extends Model
{
use HasFactory;
protected $guarded = [
protected $fillable = [
'user_id',
];
protected $guarded = [
'updated_at',
];
public function schoolClass()
{
return $this->belongsTo(SchoolClass::class, 'class_id');
return $this->belongsTo(SchoolClass::class, 'class_id')->where('');
}
public function scores()
{
return $this->hasMany(Journal::class, 'student_id');
}
}

View File

@@ -10,7 +10,7 @@ class Teacher extends Model
{
use HasFactory;
protected $guarded = [
protected $fillable = [
'user_id',
];

View File

@@ -5,7 +5,6 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Carbon\Carbon;
class User extends Authenticatable
{
@@ -58,11 +57,11 @@ class User extends Authenticatable
return $this->hasOne(HeadTeacher::class);
}
public function makeToken(bool $remember)
{
$token = $this->createToken(config('app.name'));
$token->token->expires_at = $remember ? Carbon::now()->addMonth() : Carbon::now()->addDay();
$token->token->save();
return $token;
}
// public function makeToken(bool $remember)
// {
// $token = $this->createToken(config('app.name'));
// $token->token->expires_at = $remember ? Carbon::now()->addMonth() : Carbon::now()->addDay();
// $token->token->save();
// return $token;
// }
}