Current File : //proc/self/root/proc/self/root/var/www/html/app/Models/Facture.php
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Facture extends Model
{
use HasFactory;
protected $fillable = [
'num_facture',
'type',
'date',
'taux_id',
'client_id',
];
public function taux(){
return $this->hasOne(Taux::class);
}
public function user() {
return $this->hasOne(User::class, 'id' , 'client_id');
}
public function commande() {
return $this->hasOne(Commande::class, 'facture_id', 'id');
}
public function products() {
return $this->hasMany(Product::class, 'facture_id', 'id')->whereNotIn('parent_id', [0]);
}
}