Files
ladill-pos/app/Providers/AppServiceProvider.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

51 lines
1.7 KiB
PHP

<?php
namespace App\Providers;
use App\Models\PosLocation;
use App\Services\Pos\SubscriptionService;
use Illuminate\Support\ServiceProvider;
use App\Support\MobileTopbar;
use Illuminate\Support\Facades\View;
class AppServiceProvider extends ServiceProvider
{
public function register(): void
{
//
}
public function boot(): void
{
View::composer(['partials.topbar'], function ($view) {
$view->with(MobileTopbar::resolve());
});
// Expose whether the signed-in account runs in restaurant mode so the
// sidebar can surface the Floor + Kitchen nav only when relevant.
View::composer('partials.sidebar', function ($view) {
$account = ladill_account();
$restaurant = false;
if ($account) {
$actingLocation = request()->attributes->get('actingLocation');
if ($actingLocation instanceof PosLocation) {
$restaurant = $actingLocation->isRestaurant();
} else {
$restaurant = PosLocation::owned((string) $account->public_id)
->where('service_style', PosLocation::STYLE_RESTAURANT)
->exists();
}
$svc = app(SubscriptionService::class);
$view->with('isPro', $svc->isPro($account));
$view->with('hasPaidPlan', $svc->hasPaidPlan($account));
$view->with('isEnterprise', $svc->isEnterprise($account));
} else {
$view->with('isPro', false);
$view->with('hasPaidPlan', false);
$view->with('isEnterprise', false);
}
$view->with('posRestaurant', $restaurant);
});
}
}