Laravel วิธีตั้งค่าให้เป็น https เมื่ออยู่บน production

Ask by Save Pongsiri 4 months ago
<?php
namespace App\Providers;
...
use Illuminate\Support\Facades\Schema;
...
class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        ...
    }
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    { 
        if (config('app.env') == 'production') {
            $this->app['url']->forceScheme('https');
        }
    }
}



0 Replies


Your Reply