41 lines
1.1 KiB
PHP
41 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Illuminate\Support\Facades\App;
|
|
use Illuminate\Support\Facades\Session;
|
|
use Illuminate\Support\Facades\Gate;
|
|
use App\Models\Item;
|
|
use App\Models\PettyCash;
|
|
use App\Models\InventoryTransaction;
|
|
use App\Policies\ItemPolicy;
|
|
use App\Policies\PettyCashPolicy;
|
|
use App\Policies\InventoryTransactionPolicy;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
public function register(): void
|
|
{
|
|
//
|
|
}
|
|
|
|
public function boot(): void
|
|
{
|
|
if ($locale = Session::get('locale')) {
|
|
if (in_array($locale, array_keys(config('projectra.supported_locales')))) {
|
|
App::setLocale($locale);
|
|
}
|
|
}
|
|
|
|
if (app()->environment('production')) {
|
|
\URL::forceScheme('https');
|
|
}
|
|
|
|
// Register policies explicitly (ensures discovery even without AuthServiceProvider)
|
|
Gate::policy(Item::class, ItemPolicy::class);
|
|
Gate::policy(PettyCash::class, PettyCashPolicy::class);
|
|
Gate::policy(InventoryTransaction::class, InventoryTransactionPolicy::class);
|
|
}
|
|
}
|