2021-03-10 18:30:10 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
|
|
|
|
class Objectives extends Model
|
|
|
|
|
{
|
2021-03-12 14:42:15 +01:00
|
|
|
protected $table = 'objectives';
|
|
|
|
|
|
2021-03-10 18:30:10 +01:00
|
|
|
use HasFactory;
|
2021-03-12 14:42:15 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The attributes that are mass assignable.
|
|
|
|
|
*
|
|
|
|
|
* @var array
|
|
|
|
|
*/
|
|
|
|
|
protected $fillable = [
|
|
|
|
|
'produit',
|
|
|
|
|
'qualite',
|
|
|
|
|
'campagne',
|
|
|
|
|
'quantite',
|
|
|
|
|
'prix',
|
|
|
|
|
'echeance',
|
|
|
|
|
'volume_restant',
|
|
|
|
|
'observations',
|
2023-08-21 15:24:32 +02:00
|
|
|
'customer_id',
|
2021-03-30 17:07:16 +02:00
|
|
|
'status_id',
|
|
|
|
|
'goal_at',
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The attributes that should be cast to native types.
|
|
|
|
|
*
|
|
|
|
|
* @var array
|
|
|
|
|
*/
|
|
|
|
|
protected $casts = [
|
|
|
|
|
'goal_at' => 'datetime',
|
2021-03-12 14:42:15 +01:00
|
|
|
];
|
|
|
|
|
|
2023-08-21 15:24:32 +02:00
|
|
|
public function customer()
|
2021-03-12 14:42:15 +01:00
|
|
|
{
|
2023-08-21 15:24:32 +02:00
|
|
|
return $this->hasOne(Customer::class, 'id', 'customer_id');
|
2021-03-30 17:07:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function status()
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsTo(ObjectiveStatus::class, 'status_id');
|
2021-03-12 14:42:15 +01:00
|
|
|
}
|
2021-03-10 18:30:10 +01:00
|
|
|
}
|