36 lines
654 B
PHP
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');
|
|
}
|
|
|
|
}
|