generated from liutk/owl-admin-base
44 lines
914 B
PHP
44 lines
914 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Traits\HasDateTimeFormatter;
|
|
use EloquentFilter\Filterable;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class LedgerItem extends Model
|
|
{
|
|
use Filterable, HasDateTimeFormatter, HasFactory;
|
|
|
|
protected $casts = [
|
|
'approved' => 'bool',
|
|
];
|
|
|
|
protected $fillable = [
|
|
'ledger_id',
|
|
'ledger_item_type_id',
|
|
'store_id',
|
|
'date',
|
|
'sales',
|
|
'expenditure',
|
|
'approved',
|
|
];
|
|
|
|
public function ledger(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Ledger::class);
|
|
}
|
|
|
|
public function type(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Keyword::class, 'ledger_item_type_id', 'key');
|
|
}
|
|
|
|
public function store(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Store::class);
|
|
}
|
|
}
|