ldc-mesbr-app/app/Site.php
Vincent BRIDIER 203922849c
fix: PHPCBF
2025-04-03 09:30:16 +02:00

76 lines
1.3 KiB
PHP

<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Site extends Model
{
/**
* @var string
*/
protected $table = 'site';
/**
* @var string
*/
protected $primaryKey = 'id';
/**
* @var string
*/
protected $keyType = 'string';
/**
* @var boolean
*/
public $timestamps = false;
/**
* @var array
*/
protected $fillable = ['site_nom', 'site_logo', 'site_contact', 'site_rcs', 'site_libelle'];
/**
* OneToMany
* Site -> Campagne
*/
public function campagnes()
{
return $this->hasMany('App\Campagne', 'camp_siteId', 'site_id');
}
/**
* OneToMany
* Site -> Contact
*/
public function contacts()
{
return $this->hasMany('App\Contact', 'contact_siteId', 'site_id');
}
/**
* The users that belong to the site.
*/
public function users()
{
return $this->belongsToMany('App\User', 'site_user', 'site_id', 'user_id');
}
/**
* OneToMany
* Site -> Coupon
*/
public function coupons()
{
return $this->hasMany('App\Coupon', 'coupon_siteId', 'id');
}
/**
* @return string
*/
public function __toString()
{
return $this->site_id . " : " . $this->site_nom;
}
}