40 lines
1.2 KiB
PHP
40 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Services\Admin\AdminService;
|
|
use App\Services\Admin\Contracts\AdminServiceInterface;
|
|
use App\Services\Auth\AuthService;
|
|
use App\Services\Auth\Contracts\AuthServiceInterface;
|
|
use App\Services\User\Contracts\UserServiceInterface;
|
|
use App\Services\User\UserService;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\Log;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
public function register(): void
|
|
{
|
|
$this->app->bind(AuthServiceInterface::class, AuthService::class);
|
|
$this->app->bind(AdminServiceInterface::class, AdminService::class);
|
|
$this->app->bind(UserServiceInterface::class, UserService::class);
|
|
}
|
|
|
|
public function boot(): void
|
|
{
|
|
if (config('app.debug')) {
|
|
DB::listen(function ($query) {
|
|
Log::channel('query')->info(
|
|
sprintf(
|
|
"[%s ms] %s | Bindings: %s",
|
|
$query->time,
|
|
$query->sql,
|
|
json_encode($query->bindings)
|
|
)
|
|
);
|
|
});
|
|
}
|
|
}
|
|
}
|