34 lines
827 B
PHP
34 lines
827 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class Commandes extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = "Commandes";
|
|
protected $primaryKey = "id";
|
|
public $incrementing = true;
|
|
public $timestamps = true;
|
|
protected $casts = [
|
|
'adresse' => 'json',
|
|
'created_at' => 'timestamp',
|
|
'updated_at' => 'timestamp',
|
|
];
|
|
|
|
public function Client(): BelongsTo
|
|
{
|
|
return $this->belongsTo('App\Models\Clients', 'clients_id', 'id');
|
|
}
|
|
|
|
public function LignesCommandes(): HasMany
|
|
{
|
|
return $this->hasMany('App\Models\Lignes_Commandes', 'comandes_id', 'id');
|
|
}
|
|
}
|