Files
star-erp/app/Providers/AppServiceProvider.php
sky121113 6204f0d915
All checks were successful
Koori-ERP-Deploy-System / deploy-demo (push) Has been skipped
Koori-ERP-Deploy-System / deploy-production (push) Successful in 1m4s
feat: 新增商品 Excel 匯入功能與修復 HTTPS 混合內容問題
1. 新增商品 Excel 匯入功能 (ProductImport, Export Template)
2. 調整商品代號驗證規則為 1-5 碼 (Controller & Import)
3. 修正 HTTPS Mixed Content 問題 (AppServiceProvider)
2026-02-02 14:39:13 +08:00

40 lines
1.1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\Facades\Route;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
public function boot(): void
{
// 如果是在正式環境或 APP_URL 是 https強制轉為 https
if ($this->app->environment('production') || str_contains(config('app.url'), 'https')) {
URL::forceScheme('https');
}
// 隱含授權:讓 "super-admin" 角色擁有所有權限
\Illuminate\Support\Facades\Gate::before(function ($user, $ability) {
return $user->hasRole('super-admin') ? true : null;
});
// 載入房東後台路由 (只在 central domain 可用)
$this->app->booted(function () {
if (file_exists(base_path('routes/landlord.php'))) {
Route::middleware('web')->group(base_path('routes/landlord.php'));
}
});
}
}