<?php

namespace App\Providers;

use Illuminate\Pagination\Paginator;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     */
    public function register(): void
    {
        //
    }

    /**
     * Bootstrap any application services.
     */
    public function boot(): void
    {
        if (config('app.env') !== 'local') {

            URL::forceScheme('https');
        }
        // 註冊 Line 驅動
        \Socialite::extend('line', function ($app) {
            $config = $app['config']['services.line'];
            return new \SocialiteProviders\Line\Provider(
                $app['request'], $config['client_id'], $config['client_secret'], $config['redirect']
            );
        });

        // 设置默认分页视图为 Materialize 样式
        Paginator::defaultView('vendor.pagination.materialize');

        // 可选：设置简单分页的默认视图
        Paginator::defaultSimpleView('vendor.pagination.materialize');
    }
}
