43 lines
748 B
PHP
43 lines
748 B
PHP
<?php
|
|
|
|
namespace App;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Dossier extends Model
|
|
{
|
|
|
|
/**
|
|
* The marques that belong to the dossier.
|
|
*/
|
|
public function marques()
|
|
{
|
|
return $this->belongsToMany('App\Marque', 'marques_dossiers', 'dossier_id', 'marque_id');
|
|
}
|
|
|
|
/**
|
|
* Get the sujet that owns the dossier.
|
|
*/
|
|
public function sujet()
|
|
{
|
|
return $this->belongsTo('App\Sujet', 'sujet_id');
|
|
}
|
|
|
|
/**
|
|
* Get the dossiers for the parent.
|
|
*/
|
|
public function sousdossiers()
|
|
{
|
|
return $this->hasMany('App\Dossier', 'parent_id');
|
|
}
|
|
|
|
/**
|
|
* Get the parent that owns the dossiers.
|
|
*/
|
|
public function dossierParent()
|
|
{
|
|
return $this->belongsTo('App\Dossier', 'id', 'parent_id');
|
|
}
|
|
|
|
|
|
}
|