Initial commit with contrats and domaines modules
This commit is contained in:
35
app/Models/Fournisseur.php
Normal file
35
app/Models/Fournisseur.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class Fournisseur extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'nom', 'raison_sociale', 'siret', 'adresse', 'code_postal', 'ville',
|
||||
'telephone', 'email', 'contact_commercial', 'email_commercial',
|
||||
'telephone_commercial', 'site_web', 'notes', 'active',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'active' => 'boolean',
|
||||
];
|
||||
|
||||
public function commandes(): HasMany
|
||||
{
|
||||
return $this->hasMany(Commande::class);
|
||||
}
|
||||
|
||||
public function articles(): HasMany
|
||||
{
|
||||
return $this->hasMany(Article::class);
|
||||
}
|
||||
|
||||
public function scopeActive(Builder $query): Builder
|
||||
{
|
||||
return $query->where('active', true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user