59 lines
1.7 KiB
PHP
59 lines
1.7 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\Models\Expense;
|
|
use App\Models\Employee;
|
|
use App\Models\Task;
|
|
use App\Models\Project;
|
|
use App\Models\Attachment;
|
|
use App\Models\Letter;
|
|
use App\Policies\ItemPolicy;
|
|
use App\Policies\PettyCashPolicy;
|
|
use App\Policies\InventoryTransactionPolicy;
|
|
use App\Policies\ExpensePolicy;
|
|
use App\Policies\EmployeePolicy;
|
|
use App\Policies\TaskPolicy;
|
|
use App\Policies\ProjectPolicy;
|
|
use App\Policies\AttachmentPolicy;
|
|
use App\Policies\LetterPolicy;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
public function register(): void
|
|
{
|
|
//
|
|
}
|
|
|
|
public function boot(): void
|
|
{
|
|
if ($locale = Session::get('locale')) {
|
|
if (in_array($locale, array_keys(config('Vernova.supported_locales')))) {
|
|
App::setLocale($locale);
|
|
}
|
|
}
|
|
|
|
if (app()->environment('production')) {
|
|
\URL::forceScheme('https');
|
|
}
|
|
|
|
// Register all policies explicitly
|
|
Gate::policy(Item::class, ItemPolicy::class);
|
|
Gate::policy(PettyCash::class, PettyCashPolicy::class);
|
|
Gate::policy(InventoryTransaction::class, InventoryTransactionPolicy::class);
|
|
Gate::policy(Expense::class, ExpensePolicy::class);
|
|
Gate::policy(Employee::class, EmployeePolicy::class);
|
|
Gate::policy(Task::class, TaskPolicy::class);
|
|
Gate::policy(Project::class, ProjectPolicy::class);
|
|
Gate::policy(Attachment::class, AttachmentPolicy::class);
|
|
Gate::policy(Letter::class, LetterPolicy::class);
|
|
}
|
|
}
|