ldc-dam/app/Models/Sujet.php

73 lines
1.4 KiB
PHP
Raw Normal View History

2019-05-16 17:20:30 +02:00
<?php
namespace App\Models;
2019-05-16 17:20:30 +02:00
use Illuminate\Database\Eloquent\Model;
class Sujet extends Model
{
2019-05-16 17:20:30 +02:00
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'codeSujet';
2019-05-16 17:20:30 +02:00
/**
* The users that belong to the sujet.
*/
public function users()
{
return $this->belongsToMany('App\User', 'sujets_users', 'sujet_id', 'user_id');
}
2019-05-17 11:35:41 +02:00
/**
* Get the dossier for the sujet.
*/
public function dossiers()
{
return $this->hasMany('App\Models\Dossier');
2019-05-17 11:35:41 +02:00
}
2019-05-22 17:10:16 +02:00
/**
* Get the variantes for the sujet.
*/
public function variantes()
{
2020-07-17 11:17:54 +02:00
return $this->hasMany('App\Models\Variante', 'sujet_id', 'codeSujet');
}
/**
* Get the typeVue for the sujet.
*/
public function typeVues()
{
2020-07-17 11:17:54 +02:00
return $this->hasMany('App\Models\Typevue', 'sujet_id', 'codeSujet');
}
2019-05-22 17:10:16 +02:00
/**
* Get the medias for the sujet.
*/
public function medias()
{
return $this->hasMany('App\Models\Media');
2019-05-22 17:10:16 +02:00
}
/**
* The formats that belong to the sujet.
*/
public function formats()
{
return $this->belongsToMany('App\Models\Format', 'sujets_formats', 'sujet_id', 'format_id');
}
2019-07-25 09:43:06 +02:00
/**
* Get the recherches for the sujet.
*/
public function recherches()
{
return $this->hasMany('App\Models\Recherche');
2019-07-25 09:43:06 +02:00
}
2019-05-16 17:20:30 +02:00
}