ldc-jeusselin/app/Models/Objectives.php

52 lines
961 B
PHP
Raw Permalink Normal View History

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',
'customer_id',
'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
];
public function customer()
2021-03-12 14:42:15 +01:00
{
return $this->hasOne(Customer::class, 'id', 'customer_id');
}
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
}