ldc-jeusselin/app/Models/Objectives.php
2021-03-30 17:07:16 +02:00

51 lines
945 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Objectives extends Model
{
protected $table = 'objectives';
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'produit',
'qualite',
'campagne',
'quantite',
'prix',
'echeance',
'volume_restant',
'observations',
'user_id',
'status_id',
'goal_at',
];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'goal_at' => 'datetime',
];
public function user()
{
return $this->hasOne(User::class, 'id', 'user_id');
}
public function status()
{
return $this->belongsTo(ObjectiveStatus::class, 'status_id');
}
}