aboutsummaryrefslogtreecommitdiffstats
path: root/source/app/Models/Company.php
blob: bbccd11b52f6f46cf6548fe0fec03d806593c488 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Laravel\Sanctum\HasApiTokens;

class Company extends Authenticatable
{
    // zodat de seeding zou werken moet je de factory functie implementeren
    use HasFactory, HasApiTokens;

    // Deze velden mogen ingevuld worden via mass-assignment
    protected $hidden = ['password'];
    protected $fillable = [
        'name',
        'email',
        'password',
        'plan_type',
        'job_types',
        'job_domain',
        'booth_location',
        'photo',
        'speeddate_duration',
        'company_description',
        'job_title',
        'job_requirements',
        'job_description',
        'company_location',
    ];

    // Relatie: een bedrijf kan meerdere afspraken hebben
    public function appointment(): HasMany
    {
        return $this->hasMany(Appointment::class);
    }

    // Relatie: een bedrijf kan meerdere matches hebben
    public function connections(): HasMany
    {
        return $this->hasMany(Connection::class);
    }

    public function skills(): BelongsToMany
    {
        return $this->belongsToMany(Skill::class);
    }
}