2019-05-16 17:20:30 +02:00
|
|
|
<?php
|
|
|
|
|
|
2019-09-12 11:08:25 +02:00
|
|
|
namespace App\Models;
|
2019-05-16 17:20:30 +02:00
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
|
|
|
|
class Sujet extends Model
|
|
|
|
|
{
|
2022-04-19 16:07:27 +02:00
|
|
|
/**
|
|
|
|
|
* The primary key associated with the table.
|
|
|
|
|
*
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
protected $primaryKey = 'codeSujet';
|
2019-07-17 15:48:23 +02:00
|
|
|
|
2022-06-20 14:57:58 +02:00
|
|
|
/**
|
|
|
|
|
* Indicates if the IDs are auto-incrementing.
|
|
|
|
|
*
|
|
|
|
|
* @var boolean
|
|
|
|
|
*/
|
|
|
|
|
public $incrementing = false;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The attributes that should be cast.
|
|
|
|
|
*
|
|
|
|
|
* @var array
|
|
|
|
|
*/
|
|
|
|
|
protected $casts = [
|
|
|
|
|
'sujet_dam' => 'bool'
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
// * RELATIONSHIPS
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* BelongsToMany users relation
|
|
|
|
|
*
|
|
|
|
|
* The users that belong to the sujet.
|
|
|
|
|
*
|
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
|
|
|
|
*/
|
2022-04-19 16:07:27 +02:00
|
|
|
public function users()
|
|
|
|
|
{
|
2022-06-20 14:57:58 +02:00
|
|
|
return $this->belongsToMany(User::class);
|
2022-04-19 16:07:27 +02:00
|
|
|
}
|
2019-05-16 17:20:30 +02:00
|
|
|
|
2022-06-20 14:57:58 +02:00
|
|
|
/**
|
|
|
|
|
* HasMany dossiers relation
|
|
|
|
|
*
|
|
|
|
|
* Get the dossier for the sujet.
|
|
|
|
|
*
|
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
|
|
|
*/
|
2022-04-19 16:07:27 +02:00
|
|
|
public function dossiers()
|
|
|
|
|
{
|
2022-06-20 14:57:58 +02:00
|
|
|
return $this->hasMany(Dossier::class);
|
2022-04-19 16:07:27 +02:00
|
|
|
}
|
2019-05-22 17:10:16 +02:00
|
|
|
|
2022-06-20 14:57:58 +02:00
|
|
|
/**
|
|
|
|
|
* HasMany variantes relation
|
|
|
|
|
*
|
|
|
|
|
* Get the variantes for the sujet.
|
|
|
|
|
*
|
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
|
|
|
*/
|
2022-04-19 16:07:27 +02:00
|
|
|
public function variantes()
|
|
|
|
|
{
|
2022-06-20 14:57:58 +02:00
|
|
|
return $this->hasMany(Variante::class, 'sujet_id', 'codeSujet');
|
2022-04-19 16:07:27 +02:00
|
|
|
}
|
2019-07-11 11:45:47 +02:00
|
|
|
|
2022-06-20 14:57:58 +02:00
|
|
|
/**
|
|
|
|
|
* HasMany typeVues relation
|
|
|
|
|
*
|
|
|
|
|
* Get the typeVue for the sujet.
|
|
|
|
|
*
|
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
|
|
|
*/
|
2022-04-19 16:07:27 +02:00
|
|
|
public function typeVues()
|
|
|
|
|
{
|
2022-06-20 14:57:58 +02:00
|
|
|
return $this->hasMany(TypeVue::class, 'sujet_id', 'codeSujet');
|
2022-04-19 16:07:27 +02:00
|
|
|
}
|
2019-07-11 11:45:47 +02:00
|
|
|
|
2022-06-20 14:57:58 +02:00
|
|
|
/**
|
|
|
|
|
* HasMany media relation
|
|
|
|
|
*
|
|
|
|
|
* Get the media for the sujet.
|
|
|
|
|
*
|
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
|
|
|
*/
|
|
|
|
|
public function mediaList()
|
2022-04-19 16:07:27 +02:00
|
|
|
{
|
2022-06-20 14:57:58 +02:00
|
|
|
return $this->hasMany(Media::class);
|
2022-04-19 16:07:27 +02:00
|
|
|
}
|
2019-07-11 11:45:47 +02:00
|
|
|
|
2022-06-20 14:57:58 +02:00
|
|
|
/**
|
|
|
|
|
* BelongsToMany formats relation
|
|
|
|
|
*
|
|
|
|
|
* The formats that belong to the sujet.
|
|
|
|
|
*
|
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
|
|
|
|
*/
|
2022-04-19 16:07:27 +02:00
|
|
|
public function formats()
|
|
|
|
|
{
|
2022-06-20 14:57:58 +02:00
|
|
|
return $this->belongsToMany(Format::class, 'sujet_format', 'sujet_id');
|
2022-04-19 16:07:27 +02:00
|
|
|
}
|
2019-07-25 09:43:06 +02:00
|
|
|
|
2022-06-20 14:57:58 +02:00
|
|
|
/**
|
|
|
|
|
* HasMany recherches relation
|
|
|
|
|
*
|
|
|
|
|
* Get the recherches for the sujet.
|
|
|
|
|
*
|
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
|
|
|
*/
|
2022-04-19 16:07:27 +02:00
|
|
|
public function recherches()
|
|
|
|
|
{
|
2022-06-20 14:57:58 +02:00
|
|
|
return $this->hasMany(Recherche::class);
|
2022-04-19 16:07:27 +02:00
|
|
|
}
|
2019-05-16 17:20:30 +02:00
|
|
|
}
|