Files
ladill-pos/app/Models/PosMember.php
T
isaaccladandCursor 9d7dac6c24
Deploy Ladill POS / deploy (push) Successful in 1m58s
Add multi-branch POS with team roles and branch-scoped cashiers.
Pro and Business users can manage branches, invite cashiers with branch assignment, and switch registers; sales and register flows respect acting location.

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

39 lines
825 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class PosMember extends Model
{
public const ROLE_ADMIN = 'admin';
public const ROLE_MANAGER = 'manager';
public const ROLE_CASHIER = 'cashier';
protected $fillable = [
'owner_ref',
'user_ref',
'role',
'location_id',
];
public function location(): BelongsTo
{
return $this->belongsTo(PosLocation::class, 'location_id');
}
public function hasRole(string ...$roles): bool
{
return in_array($this->role, $roles, true);
}
public function scopeOwned(Builder $query, string $ownerRef): Builder
{
return $query->where('owner_ref', $ownerRef);
}
}