From 7865047cf57d73ef0e42add22faa46861c5a7542 Mon Sep 17 00:00:00 2001 From: EL OUFIR Hatim Date: Mon, 19 Sep 2022 17:31:24 +0100 Subject: [PATCH 1/3] Bug fix: ticket creation --- app/Models/Ticket.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Models/Ticket.php b/app/Models/Ticket.php index 5f93811..27b4a65 100644 --- a/app/Models/Ticket.php +++ b/app/Models/Ticket.php @@ -64,7 +64,7 @@ public function comments(): HasMany public function ticketNumber(): Attribute { return new Attribute( - get: fn() => $this->project->ticket_prefix . '' . $this->number + get: fn() => $this->project?->ticket_prefix . '' . $this->number ); } } From 3ae034735c2a5bebc93ff4c857056763a819b292 Mon Sep 17 00:00:00 2001 From: EL OUFIR Hatim Date: Mon, 19 Sep 2022 17:32:29 +0100 Subject: [PATCH 2/3] Larabug implementation --- composer.json | 1 + composer.lock | 72 +++++++++++++++++++++- config/larabug.php | 145 +++++++++++++++++++++++++++++++++++++++++++++ config/logging.php | 6 +- 4 files changed, 221 insertions(+), 3 deletions(-) create mode 100644 config/larabug.php diff --git a/composer.json b/composer.json index 29ae0de..992f2d8 100644 --- a/composer.json +++ b/composer.json @@ -10,6 +10,7 @@ "filament/notifications": "^2.15", "guzzlehttp/guzzle": "^7.2", "invaders-xx/filament-kanban-board": "^0.2.6", + "larabug/larabug": "^2.5", "laravel/framework": "^9.19", "laravel/sanctum": "^3.0", "laravel/tinker": "^2.7", diff --git a/composer.lock b/composer.lock index c758419..e4aaae6 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "baed92234ce3f3ea6223795f8e4f729f", + "content-hash": "b805d399685bbd02953d908a95aea126", "packages": [ { "name": "akaunting/laravel-money", @@ -1571,6 +1571,74 @@ }, "time": "2022-07-17T08:00:58+00:00" }, + { + "name": "larabug/larabug", + "version": "2.5.3", + "source": { + "type": "git", + "url": "https://github.com/LaraBug/LaraBug.git", + "reference": "e1609ee592633e27d9102a4473f8fe9937c179c9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/LaraBug/LaraBug/zipball/e1609ee592633e27d9102a4473f8fe9937c179c9", + "reference": "e1609ee592633e27d9102a4473f8fe9937c179c9", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": "^6.0.2 || ^7.0", + "illuminate/support": "^6.0 || ^7.0 || ^8.0 || ^9.0", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.4", + "mockery/mockery": "^1.3.3 || ^1.4.2", + "orchestra/testbench": "^4.0 || ^5.0 || ^6.0 || ^7.0", + "phpunit/phpunit": "^8.5.23 || ^9.5.12" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "LaraBug\\ServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "LaraBug\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dennis Smink", + "email": "dennissmink@gmail.com", + "homepage": "http://www.dennissmink.nl", + "role": "Owner" + } + ], + "description": "Laravel 6.x/7.x/8.x/9.x bug notifier", + "keywords": [ + "error", + "laravel", + "log" + ], + "support": { + "issues": "https://github.com/LaraBug/LaraBug/issues", + "source": "https://github.com/LaraBug/LaraBug/tree/2.5.3" + }, + "funding": [ + { + "url": "https://github.com/cannonb4ll", + "type": "github" + } + ], + "time": "2022-06-30T13:26:41+00:00" + }, { "name": "laravel/framework", "version": "v9.30.1", @@ -8927,5 +8995,5 @@ "php": "^8.0.2" }, "platform-dev": [], - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.1.0" } diff --git a/config/larabug.php b/config/larabug.php new file mode 100644 index 0000000..adfb36f --- /dev/null +++ b/config/larabug.php @@ -0,0 +1,145 @@ + env('LB_KEY', ''), + + /* + |-------------------------------------------------------------------------- + | Project key + |-------------------------------------------------------------------------- + | + | This is your project key which you receive when creating a project + | Retrieve your key from https://www.larabug.com + | + */ + + 'project_key' => env('LB_PROJECT_KEY', ''), + + /* + |-------------------------------------------------------------------------- + | Environment setting + |-------------------------------------------------------------------------- + | + | This setting determines if the exception should be send over or not. + | + */ + + 'environments' => [ + 'production', + ], + + /* + |-------------------------------------------------------------------------- + | Project version + |-------------------------------------------------------------------------- + | + | Set the project version, default: null. + | For git repository: shell_exec("git log -1 --pretty=format:'%h' --abbrev-commit") + | + */ + 'project_version' => null, + + /* + |-------------------------------------------------------------------------- + | Lines near exception + |-------------------------------------------------------------------------- + | + | How many lines to show near exception line. The more you specify the bigger + | the displayed code will be. Max value can be 50, will be defaulted to + | 12 if higher than 50 automatically. + | + */ + + 'lines_count' => 12, + + /* + |-------------------------------------------------------------------------- + | Prevent duplicates + |-------------------------------------------------------------------------- + | + | Set the sleep time between duplicate exceptions. This value is in seconds, default: 60 seconds (1 minute) + | + */ + + 'sleep' => 60, + + /* + |-------------------------------------------------------------------------- + | Skip exceptions + |-------------------------------------------------------------------------- + | + | List of exceptions to skip sending. + | + */ + + 'except' => [ + 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException', + ], + + /* + |-------------------------------------------------------------------------- + | Key filtering + |-------------------------------------------------------------------------- + | + | Filter out these variables before sending them to LaraBug + | + */ + + 'blacklist' => [ + '*authorization*', + '*password*', + '*token*', + '*auth*', + '*verification*', + '*credit_card*', + 'cardToken', // mollie card token + '*cvv*', + '*iban*', + '*name*', + '*email*' + ], + + /* + |-------------------------------------------------------------------------- + | Release git hash + |-------------------------------------------------------------------------- + | + | + */ + + // 'release' => trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')), + + /* + |-------------------------------------------------------------------------- + | Server setting + |-------------------------------------------------------------------------- + | + | This setting allows you to change the server. + | + */ + + 'server' => env('LB_SERVER', 'https://www.larabug.com/api/log'), + + /* + |-------------------------------------------------------------------------- + | Verify SSL setting + |-------------------------------------------------------------------------- + | + | Enables / disables the SSL verification when sending exceptions to LaraBug + | Never turn SSL verification off on production instances + | + */ + 'verify_ssl' => env('LB_VERIFY_SSL', true), + +]; diff --git a/config/logging.php b/config/logging.php index 5aa1dbb..33deed1 100644 --- a/config/logging.php +++ b/config/logging.php @@ -51,9 +51,13 @@ */ 'channels' => [ + 'larabug' => [ + 'driver' => 'larabug', + ], + 'stack' => [ 'driver' => 'stack', - 'channels' => ['single'], + 'channels' => ['single', 'larabug'], 'ignore_exceptions' => false, ], From db93a80229fb73e7a8309138cf1bc45ddb6c255a Mon Sep 17 00:00:00 2001 From: EL OUFIR Hatim Date: Mon, 19 Sep 2022 17:33:58 +0100 Subject: [PATCH 3/3] Update docs --- public/docs/index.html | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/public/docs/index.html b/public/docs/index.html index ecce338..535f6c0 100644 --- a/public/docs/index.html +++ b/public/docs/index.html @@ -54,7 +54,7 @@ - v1.2.2 + v1.2.3 @@ -91,6 +91,7 @@