ldc-boutique-cnc/app/Models/OrderLine.php

29 lines
594 B
PHP
Raw Permalink Normal View History

2021-03-27 20:55:16 +01:00
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class OrderLine extends Model
{
use HasFactory;
//Relations
2021-03-27 20:55:16 +01:00
public function order()
{
return $this->belongsTo(Order::class);
}
public function product()
{
2021-03-29 15:10:07 +02:00
return $this->belongsTo(Product::class);
2021-03-27 20:55:16 +01:00
}
//Formattages
public function getFormattedTotalTtcAttribute()
{
return $this->attributes['formattedTotalTtc'] = sprintf('%s €', number_format($this->attributes['total_ttc'], 2, ',', ' '));
}
2021-03-27 20:55:16 +01:00
}