fixes on invoices relations and revisions
This commit is contained in:
@@ -3,19 +3,32 @@
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
use Venturecraft\Revisionable\RevisionableTrait;
|
||||
use Znck\Eloquent\Traits\BelongsToThrough;
|
||||
|
||||
class Invoice extends Model
|
||||
{
|
||||
use BelongsToThrough, RevisionableTrait, SoftDeletes;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_invoices';
|
||||
protected $revisionCreationsEnabled = false;
|
||||
protected $keepRevisionOf = ['status', 'total_taxed', 'shipping', 'total_shipped'];
|
||||
|
||||
public function InvoiceItems()
|
||||
public function payments()
|
||||
{
|
||||
return $this->hasMany(InvoiceItem::class);
|
||||
return $this->hasMany(InvoicePayment::class);
|
||||
}
|
||||
|
||||
public function Customer()
|
||||
public function order()
|
||||
{
|
||||
return $this->belongsTo(Customer::class);
|
||||
return $this->belongsTo(Order::class);
|
||||
}
|
||||
|
||||
public function customer()
|
||||
{
|
||||
return $this->belongsToThrough(Customer::class, Order::class, null, '', [Customer::class => 'customer_id', Order::class => 'order_id']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user