Deploy Ladill POS / deploy (push) Successful in 1m58s
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>
39 lines
825 B
PHP
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);
|
|
}
|
|
}
|