71 lines
1.5 KiB
PHP
71 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models\Market;
|
|
|
|
use App\Models\Model;
|
|
use App\Models\User;
|
|
|
|
class PosSession extends Model
|
|
{
|
|
protected ?string $table = 'pos_sessions';
|
|
|
|
protected array $fillable = [
|
|
'hashkey',
|
|
'access_key',
|
|
'store_id',
|
|
'created_by',
|
|
'updated_by',
|
|
'customer_name',
|
|
'total_amount',
|
|
'received_amount',
|
|
'change_amount',
|
|
'payment_method',
|
|
'payment_details',
|
|
'status',
|
|
'is_void',
|
|
'notes',
|
|
'additionaldata',
|
|
];
|
|
|
|
protected array $casts = [
|
|
'is_void' => 'boolean',
|
|
'payment_details' => 'array',
|
|
'additionaldata' => 'array',
|
|
'total_amount' => 'integer',
|
|
'received_amount' => 'integer',
|
|
'change_amount' => 'integer',
|
|
'created_by' => 'integer',
|
|
'updated_by' => 'integer',
|
|
];
|
|
|
|
public function updater()
|
|
{
|
|
return $this->belongsTo(User::class, 'updated_by');
|
|
}
|
|
|
|
/**
|
|
* Relationships
|
|
*/
|
|
public function transactions()
|
|
{
|
|
return $this->hasMany(PosTransaction::class, 'pos_session_id');
|
|
}
|
|
|
|
public function archives()
|
|
{
|
|
return $this->hasMany(PosSessionArchive::class, 'pos_session_id');
|
|
}
|
|
|
|
public function creator()
|
|
{
|
|
return $this->belongsTo(User::class, 'created_by');
|
|
}
|
|
|
|
public function store()
|
|
{
|
|
return $this->belongsTo(Store::class, 'store_id');
|
|
}
|
|
}
|