ldc-dam/app/Panier.php
2019-07-31 12:22:24 +02:00

36 lines
654 B
PHP

<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Panier extends Model
{
use SoftDeletes;
/**
* Get the user that owns the panier.
*/
public function owner()
{
return $this->belongsTo('App\User', 'owner');
}
/**
* The users that belong to the panier.
*/
public function usersFavoris()
{
return $this->belongsToMany('App\User', 'paniers_users', 'panier_id', 'user_id');
}
/**
* The medias that belong to the panier.
*/
public function medias()
{
return $this->belongsToMany('App\Media', 'paniers_medias', 'panier_id', 'media_id');
}
}