24 lines
458 B
PHP
24 lines
458 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Models\Kid;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
|
|
class Course extends Model
|
|
{
|
|
protected $fillable = ["name", "duration"];
|
|
|
|
public function kids(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(Kid::class)->withPivot("date");
|
|
}
|
|
|
|
public function belts(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(Belt::class);
|
|
}
|
|
|
|
}
|