Files
ladill-pos/app/Models/PosLocation.php
T
isaaccladandCursor cac7c60415
Deploy Ladill POS / deploy (push) Successful in 1m32s
Add receipt logo upload and redesign thermal receipt header.
Per-location logo in settings with remove/replace support; receipt template reserves space at the top when a logo is set.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-08 05:48:40 +00:00

70 lines
1.5 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Facades\Storage;
class PosLocation extends Model
{
public const STYLE_RETAIL = 'retail';
public const STYLE_RESTAURANT = 'restaurant';
protected $fillable = [
'owner_ref',
'name',
'currency',
'service_style',
'receipt_footer',
'receipt_header',
'receipt_logo_path',
'printer_paper_mm',
'printer_auto_print',
];
protected function casts(): array
{
return [
'printer_paper_mm' => 'integer',
'printer_auto_print' => 'boolean',
];
}
public function isRestaurant(): bool
{
return $this->service_style === self::STYLE_RESTAURANT;
}
public function receiptLogoUrl(): ?string
{
if (! $this->receipt_logo_path) {
return null;
}
return Storage::disk('public')->url($this->receipt_logo_path);
}
public function products(): HasMany
{
return $this->hasMany(PosProduct::class, 'location_id');
}
public function tables(): HasMany
{
return $this->hasMany(PosTable::class, 'location_id');
}
public function sales(): HasMany
{
return $this->hasMany(PosSale::class, 'location_id');
}
public function scopeOwned(Builder $query, string $ownerRef): Builder
{
return $query->where('owner_ref', $ownerRef);
}
}