Files
ladill-pos/app/Http/Controllers/Pos/TableController.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

56 lines
1.5 KiB
PHP

<?php
namespace App\Http\Controllers\Pos;
use App\Http\Controllers\Controller;
use App\Http\Controllers\Pos\Concerns\ScopesToAccount;
use App\Models\PosSale;
use App\Models\PosTable;
use App\Services\Pos\PosLocationService;
use Illuminate\Http\Request;
use Illuminate\View\View;
class TableController extends Controller
{
use ScopesToAccount;
public function __construct(private PosLocationService $locations) {}
public function index(Request $request): View
{
$owner = $this->ownerRef($request);
$location = $this->location($request);
$tables = $this->scopeToLocation($request, PosTable::owned($owner))
->with('currentSale')
->orderBy('area')
->orderBy('position')
->orderBy('label')
->get();
$openTickets = $this->scopeToLocation($request, PosSale::owned($owner))
->openTickets()
->with('table')
->withCount('lines')
->latest('opened_at')
->get();
return view('pos.floor', [
'location' => $location,
'tables' => $tables,
'tablesByArea' => $tables->groupBy(fn (PosTable $t) => $t->area ?: 'Floor'),
'openTickets' => $openTickets,
]);
}
public function qr(Request $request, PosTable $table): View
{
$this->authorizeOwner($request, $table);
return view('pos.tables.qr', [
'table' => $table,
'url' => route('pos.table.menu', $table->ensureShortCode()),
]);
}
}