增加 错误处理函数
This commit is contained in:
parent
cdfadad2c6
commit
dc6af92e72
15
app/Helpers/helpers.php
Normal file
15
app/Helpers/helpers.php
Normal 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;
|
||||||
|
}
|
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user