54 lines
1,006 B
PHP
54 lines
1,006 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Panier extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
/**
|
|
* @var string
|
|
*/
|
|
protected $table = 'panier';
|
|
|
|
/**
|
|
* @var string
|
|
*/
|
|
protected $primaryKey = 'panier_id';
|
|
|
|
/**
|
|
* @var boolean
|
|
*/
|
|
public $timestamps = false;
|
|
|
|
// protected $with = ['panierContents'];
|
|
/**
|
|
* OneToMany
|
|
* Panier -> PanierContent
|
|
*/
|
|
public function panierContents()
|
|
{
|
|
return $this->hasMany('App\Models\PanierContent', 'panier_content_panierId', 'panier_id');
|
|
}
|
|
|
|
/**
|
|
* ManyToOne
|
|
* Panier -> Campagne
|
|
*/
|
|
public function campagne()
|
|
{
|
|
return $this->belongsTo('App\Models\Campagne', 'panier_campId');
|
|
}
|
|
|
|
/**
|
|
* ManyToOne
|
|
* Panier -> Contact
|
|
*/
|
|
public function contact()
|
|
{
|
|
return $this->belongsTo('App\Models\Contact', 'panier_contactId');
|
|
}
|
|
}
|