aboutsummaryrefslogtreecommitdiffstats
path: root/source/app/Models/Appointment.php
blob: 98bd9791592aebee69c1c473f0e201be4c48ec76 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class Appointment extends Model
{

    // zodat de seeding zou werken moet je de factory functie implementeren
    use HasFactory;
    // Velden die massaal ingevuld mogen worden (via create of update)
    protected $fillable = [
        'student_id',
        'company_id',
        'time_start',
        'time_end'
    ];

    // Relatie: een appointment hoort bij één student
    public function student(): BelongsTo
    {
        return $this->belongsTo(Student::class);
    }

    // Relatie: een appointment hoort bij één bedrijf
    public function company(): BelongsTo
    {
        return $this->belongsTo(Company::class);
    }
}