Changeset View
Changeset View
Standalone View
Standalone View
src/app/Providers/AppServiceProvider.php
<?php | <?php | ||||
namespace App\Providers; | namespace App\Providers; | ||||
use Illuminate\Support\Facades\Blade; | use Illuminate\Support\Facades\Blade; | ||||
use Illuminate\Support\Facades\DB; | use Illuminate\Support\Facades\DB; | ||||
use Illuminate\Support\Facades\Schema; | use Illuminate\Support\Facades\Schema; | ||||
use Illuminate\Support\ServiceProvider; | use Illuminate\Support\ServiceProvider; | ||||
use Laravel\Passport\Passport; | |||||
class AppServiceProvider extends ServiceProvider | class AppServiceProvider extends ServiceProvider | ||||
{ | { | ||||
/** | /** | ||||
* Register any application services. | * Register any application services. | ||||
* | * | ||||
* @return void | * @return void | ||||
*/ | */ | ||||
public function register() | public function register() | ||||
{ | { | ||||
// | Passport::ignoreMigrations(); | ||||
} | |||||
/** | |||||
* Serialize a bindings array to a string. | |||||
* | |||||
* @return string | |||||
*/ | |||||
private static function serializeSQLBindings(array $array): string | |||||
{ | |||||
$serialized = array_map(function ($entry) { | |||||
if ($entry instanceof \DateTime) { | |||||
return $entry->format('Y-m-d h:i:s'); | |||||
} | |||||
return $entry; | |||||
}, $array); | |||||
return implode(', ', $serialized); | |||||
machniak: I don't the indentation above. And I would add a new line before return. | |||||
} | } | ||||
/** | /** | ||||
* Bootstrap any application services. | * Bootstrap any application services. | ||||
* | * | ||||
* @return void | * @return void | ||||
*/ | */ | ||||
public function boot() | public function boot() | ||||
Show All 15 Lines | public function boot() | ||||
\App\VerificationCode::observe(\App\Observers\VerificationCodeObserver::class); | \App\VerificationCode::observe(\App\Observers\VerificationCodeObserver::class); | ||||
\App\Wallet::observe(\App\Observers\WalletObserver::class); | \App\Wallet::observe(\App\Observers\WalletObserver::class); | ||||
Schema::defaultStringLength(191); | Schema::defaultStringLength(191); | ||||
// Log SQL queries in debug mode | // Log SQL queries in debug mode | ||||
if (\config('app.debug')) { | if (\config('app.debug')) { | ||||
DB::listen(function ($query) { | DB::listen(function ($query) { | ||||
\Log::debug(sprintf('[SQL] %s [%s]', $query->sql, implode(', ', $query->bindings))); | \Log::debug(sprintf('[SQL] %s [%s]', $query->sql, self::serializeSQLBindings($query->bindings))); | ||||
}); | }); | ||||
} | } | ||||
// Register some template helpers | // Register some template helpers | ||||
Blade::directive('theme_asset', function ($path) { | Blade::directive('theme_asset', function ($path) { | ||||
$path = trim($path, '/\'"'); | $path = trim($path, '/\'"'); | ||||
return "<?php echo secure_asset('themes/' . \$env['app.theme'] . '/' . '$path'); ?>"; | return "<?php echo secure_asset('themes/' . \$env['app.theme'] . '/' . '$path'); ?>"; | ||||
}); | }); | ||||
} | } | ||||
} | } |
I don't the indentation above. And I would add a new line before return.