Deploy Ladill Mini / deploy (push) Successful in 23s
Staff-facing counter register at pos.ladill.com with catalog cart, cash and MoMo/card checkout via Ladill Pay, CRM timeline/import, invoice prefill, and Merchant catalog import. Co-authored-by: Cursor <cursoragent@cursor.com>
44 lines
916 B
PHP
44 lines
916 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class PosProduct extends Model
|
|
{
|
|
protected $fillable = [
|
|
'owner_ref',
|
|
'location_id',
|
|
'name',
|
|
'sku',
|
|
'price_minor',
|
|
'currency',
|
|
'is_active',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'price_minor' => 'integer',
|
|
'is_active' => 'boolean',
|
|
];
|
|
}
|
|
|
|
public function location(): BelongsTo
|
|
{
|
|
return $this->belongsTo(PosLocation::class, 'location_id');
|
|
}
|
|
|
|
public function scopeOwned(Builder $query, string $ownerRef): Builder
|
|
{
|
|
return $query->where('owner_ref', $ownerRef);
|
|
}
|
|
|
|
public function scopeActive(Builder $query): Builder
|
|
{
|
|
return $query->where('is_active', true);
|
|
}
|
|
}
|