Files
star-cloud/app/Providers/AppServiceProvider.php

34 lines
689 B
PHP

<?php
namespace App\Providers;
use App\Listeners\LogSuccessfulLogin;
use Illuminate\Auth\Events\Login;
use Illuminate\Support\Facades\Event;
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 (!$this->app->isLocal()) {
\Illuminate\Support\Facades\URL::forceScheme('https');
}
// 記錄使用者成功登入的歷史
Event::listen(Login::class, LogSuccessfulLogin::class);
}
}