增加 错误处理函数

This commit is contained in:
iVampireSP.com 2023-03-06 10:21:30 +08:00
parent cdfadad2c6
commit dc6af92e72
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132
2 changed files with 17 additions and 0 deletions

15
app/Helpers/helpers.php Normal file
View File

@ -0,0 +1,15 @@
<?php
function t($fun): array
{
$output = [null, null, null];
try {
$output[0] = $fun();
} catch (Exception $e) {
$output[1] = $e->getMessage();
$output[2] = $e;
}
return $output;
}

View File

@ -32,6 +32,8 @@ class AppServiceProvider extends ServiceProvider
*/ */
public function boot(): void public function boot(): void
{ {
require_once app_path('Helpers/helpers.php');
Paginator::useBootstrapFive(); Paginator::useBootstrapFive();
Sanctum::usePersonalAccessTokenModel(PersonalAccessToken::class); Sanctum::usePersonalAccessTokenModel(PersonalAccessToken::class);