117 lines
2.1 KiB
PHP
117 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace App;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class Media extends Model
|
|
{
|
|
use SoftDeletes;
|
|
protected $with = "owner";
|
|
protected $table = "medias";
|
|
|
|
/**
|
|
* Get the dossier that owns the media.
|
|
*/
|
|
public function dossier()
|
|
{
|
|
return $this->belongsTo('App\Dossier', 'dossier_id');
|
|
}
|
|
|
|
/**
|
|
* Get the sujet that owns the media.
|
|
*/
|
|
public function sujet()
|
|
{
|
|
return $this->belongsTo('App\Sujet', 'sujet_id');
|
|
}
|
|
|
|
/**
|
|
* Get the typemedia that owns the media.
|
|
*/
|
|
public function typemedia()
|
|
{
|
|
return $this->belongsTo('App\Typemedia', 'typemedia_id');
|
|
}
|
|
|
|
/**
|
|
* Get the typevue that owns the media.
|
|
*/
|
|
public function typevue()
|
|
{
|
|
return $this->belongsTo('App\Typevue', 'typevue_id');
|
|
}
|
|
|
|
/**
|
|
* Get the langue that owns the media.
|
|
*/
|
|
public function langue()
|
|
{
|
|
return $this->belongsTo('App\Langue', 'typevue_id');
|
|
}
|
|
|
|
/**
|
|
* Get the copyright that owns the media.
|
|
*/
|
|
public function copyright()
|
|
{
|
|
return $this->belongsTo('App\Copyright', 'copyright_id');
|
|
}
|
|
|
|
/**
|
|
* Get the etiquette that owns the media.
|
|
*/
|
|
public function etiquette()
|
|
{
|
|
return $this->belongsTo('App\Etiquette', 'etiquette_id');
|
|
}
|
|
|
|
/**
|
|
* The tag that belong to the media.
|
|
*/
|
|
public function tags()
|
|
{
|
|
return $this->belongsToMany('App\Tag', 'medias_tags', 'media_id', 'tag_id');
|
|
}
|
|
|
|
/**
|
|
* The articles that belong to the media.
|
|
*/
|
|
public function articles()
|
|
{
|
|
return $this->belongsToMany('App\Article', 'medias_articles', 'media_id', 'article_id');
|
|
}
|
|
|
|
/**
|
|
* The sites that belong to the media.
|
|
*/
|
|
public function sites()
|
|
{
|
|
return $this->belongsToMany('App\Site', 'medias_sites', 'media_id', 'site_id');
|
|
}
|
|
|
|
/**
|
|
* The marques that belong to the media.
|
|
*/
|
|
public function marques()
|
|
{
|
|
return $this->belongsToMany('App\Marque', 'medias_marques', 'media_id', 'marque_id');
|
|
}
|
|
|
|
/**
|
|
* Get the user that owns the media.
|
|
*/
|
|
public function owner()
|
|
{
|
|
return $this->belongsTo('App\User', 'created_by');
|
|
}
|
|
|
|
/**
|
|
* Get the historiques for the media.
|
|
*/
|
|
public function historiques()
|
|
{
|
|
return $this->hasMany('App\Historique');
|
|
}
|
|
}
|