prod #7
@ -31,6 +31,11 @@ class Grade extends Model
|
|||||||
return $this->belongsToMany(Teacher::class);
|
return $this->belongsToMany(Teacher::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function lessons(): HasMany
|
||||||
|
{
|
||||||
|
return $this->hasMany(Lesson::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function scopeFilter(Builder $query): void
|
public function scopeFilter(Builder $query): void
|
||||||
{
|
{
|
||||||
$name = request('name');
|
$name = request('name');
|
||||||
|
@ -4,6 +4,7 @@ namespace App\Models;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
|
|
||||||
class Lesson extends Model
|
class Lesson extends Model
|
||||||
@ -20,4 +21,19 @@ class Lesson extends Model
|
|||||||
{
|
{
|
||||||
return $this->hasMany(Score::class);
|
return $this->hasMany(Score::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function grades(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Grade::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function teachers(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Teacher::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function subjects(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Subject::class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ use Illuminate\Contracts\Database\Eloquent\Builder;
|
|||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Illuminate\Database\Eloquent\Relations\MorphOne;
|
use Illuminate\Database\Eloquent\Relations\MorphOne;
|
||||||
|
|
||||||
class Subject extends Model
|
class Subject extends Model
|
||||||
@ -31,6 +32,11 @@ class Subject extends Model
|
|||||||
return $this->belongsToMany(Student::class)->using(Score::class);
|
return $this->belongsToMany(Student::class)->using(Score::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function lessons(): HasMany
|
||||||
|
{
|
||||||
|
return $this->hasMany(Lesson::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function scopeFilter(Builder $query): void
|
public function scopeFilter(Builder $query): void
|
||||||
{
|
{
|
||||||
$name = request('name');
|
$name = request('name');
|
||||||
|
@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Casts\Attribute;
|
|||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Illuminate\Database\Eloquent\Relations\MorphOne;
|
use Illuminate\Database\Eloquent\Relations\MorphOne;
|
||||||
|
|
||||||
class Teacher extends Model
|
class Teacher extends Model
|
||||||
@ -35,6 +36,11 @@ class Teacher extends Model
|
|||||||
return $this->morphOne(User::class, 'userable');
|
return $this->morphOne(User::class, 'userable');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function lessons(): HasMany
|
||||||
|
{
|
||||||
|
return $this->hasMany(Lesson::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function scopeFilter(Builder $query): void
|
public function scopeFilter(Builder $query): void
|
||||||
{
|
{
|
||||||
$name = request('name');
|
$name = request('name');
|
||||||
|
Loading…
Reference in New Issue
Block a user