get clients
This commit is contained in:
33
app/Models/Produits.php
Normal file
33
app/Models/Produits.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class Produits extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = "Produits";
|
||||
protected $primaryKey = "id";
|
||||
public $incrementing = true;
|
||||
public $timestamps = true;
|
||||
protected $casts = [
|
||||
'created_at' => 'timestamp',
|
||||
'updated_at' => 'timestamp',
|
||||
];
|
||||
|
||||
public function Categories(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany('App\Models\Categories', 'produits_categories', 'products_id', 'categories_id');
|
||||
}
|
||||
|
||||
public function LignesCommandes(): HasMany
|
||||
{
|
||||
return $this->hasMany('App\Models\Lignes_Commandes', 'produits_id', 'id');
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user