ldc-dam/app/Sujet.php
2019-05-22 17:10:16 +02:00

41 lines
712 B
PHP

<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Sujet extends Model
{
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'CODE_SUJET';
/**
* The users that belong to the sujet.
*/
public function users()
{
return $this->belongsToMany('App\User', 'sujets_users', 'sujet_id', 'user_id');
}
/**
* Get the dossier for the sujet.
*/
public function dossiers()
{
return $this->hasMany('App\Dossier');
}
/**
* Get the medias for the sujet.
*/
public function medias()
{
return $this->hasMany('App\Media');
}
}