diff --git a/app/Enums/FileCategory.php b/app/Enums/FileCategory.php
index 37499e3..a04cbff 100644
--- a/app/Enums/FileCategory.php
+++ b/app/Enums/FileCategory.php
@@ -2,7 +2,7 @@
namespace App\Enums;
-use Kwaadpepper\Enum\BaseEnum;
+use Kwaadpepper\Enum\BaseEnumRoutable;
/**
* @method static self collectionNeeds()
@@ -13,7 +13,7 @@ use Kwaadpepper\Enum\BaseEnum;
* @method static self feedback()
*/
-class FileCategory extends BaseEnum
+class FileCategory extends BaseEnumRoutable
{
protected static function values(): array
{
diff --git a/app/Enums/FileType.php b/app/Enums/FileType.php
index aca3062..1c75822 100644
--- a/app/Enums/FileType.php
+++ b/app/Enums/FileType.php
@@ -2,14 +2,14 @@
namespace App\Enums;
-use Kwaadpepper\Enum\BaseEnum;
+use Kwaadpepper\Enum\BaseEnumRoutable;
/**
* @method static self stringlink()
* @method static self binfile()
*/
-class FileType extends BaseEnum
+class FileType extends BaseEnumRoutable
{
protected static function values(): array
{
diff --git a/app/Enums/LoadLevel.php b/app/Enums/LoadLevel.php
index 0ceee0d..666065d 100644
--- a/app/Enums/LoadLevel.php
+++ b/app/Enums/LoadLevel.php
@@ -2,7 +2,7 @@
namespace App\Enums;
-use Kwaadpepper\Enum\BaseEnum;
+use Kwaadpepper\Enum\BaseEnumRoutable;
/**
* @method static self weak()
@@ -11,7 +11,7 @@ use Kwaadpepper\Enum\BaseEnum;
* @method static self overload()
*/
-class LoadLevel extends BaseEnum
+class LoadLevel extends BaseEnumRoutable
{
protected static function values(): array
{
diff --git a/app/Enums/Role.php b/app/Enums/Role.php
index d4a65a0..193af5f 100644
--- a/app/Enums/Role.php
+++ b/app/Enums/Role.php
@@ -2,7 +2,7 @@
namespace App\Enums;
-use Kwaadpepper\Enum\BaseEnum;
+use Kwaadpepper\Enum\BaseEnumRoutable;
/**
* @method static self developper()
@@ -10,7 +10,7 @@ use Kwaadpepper\Enum\BaseEnum;
* @method static self client()
*/
-class Role extends BaseEnum
+class Role extends BaseEnumRoutable
{
protected static function values(): array
{
diff --git a/app/Enums/TicketStatus.php b/app/Enums/TicketStatus.php
index b0fe989..62a4882 100644
--- a/app/Enums/TicketStatus.php
+++ b/app/Enums/TicketStatus.php
@@ -2,7 +2,7 @@
namespace App\Enums;
-use Kwaadpepper\Enum\BaseEnum;
+use Kwaadpepper\Enum\BaseEnumRoutable;
/**
* @method static self new()
@@ -17,7 +17,7 @@ use Kwaadpepper\Enum\BaseEnum;
* @method static self production()
* @method static self archived()
*/
-class TicketStatus extends BaseEnum
+class TicketStatus extends BaseEnumRoutable
{
protected static function values(): array
{
diff --git a/app/Enums/TicketType.php b/app/Enums/TicketType.php
index c6ca449..ad3589c 100644
--- a/app/Enums/TicketType.php
+++ b/app/Enums/TicketType.php
@@ -2,13 +2,13 @@
namespace App\Enums;
-use Kwaadpepper\Enum\BaseEnum;
+use Kwaadpepper\Enum\BaseEnumRoutable;
/**
* @method static self bug()
* @method static self evolution()
*/
-class TicketType extends BaseEnum
+class TicketType extends BaseEnumRoutable
{
protected static function values(): array
{
diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php
index 5892cad..19a1a9f 100644
--- a/app/Exceptions/Handler.php
+++ b/app/Exceptions/Handler.php
@@ -2,10 +2,7 @@
namespace App\Exceptions;
-use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
-use Illuminate\Support\Facades\Mail;
-use RuntimeException;
-use Throwable;
+use Kwaadpepper\ExceptionHandler\Exceptions\ExceptionHandler;
class Handler extends ExceptionHandler
{
@@ -29,45 +26,6 @@ class Handler extends ExceptionHandler
'password_confirmation',
];
- /**
- * Report or log an exception.
- *
- * @param \Throwable $exception
- * @return void
- *
- * @throws \Exception
- */
- public function report(Throwable $e)
- {
- if (get_class($e) == RedirectTo::class) {
- abort(redirect($e->url));
- }
- try {
- if (config('app.debug') === false) {
- if ($this->shouldntReport($e)) {
- return;
- }
- Mail::send([
- 'html' => 'emails.exception',
- 'text' => 'emails.exception-plain'
- ], [
- 'exception' => $e,
- 'appName' => config('app.name')
- ], function ($m) {
- $m->to(
- config('mail.contactsList.serviceweb'),
- sprintf('%s Exception Handler', config('app.name'))
- )->subject('Need help !, an error occured in your application, please check Logs ASAP');
- });
- }
- // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch
- } catch (RuntimeException $e) {
- // do nothing, mail send error, let laravel only handle this
- } finally {
- parent::report($e);
- }
- }
-
/**
* Register the exception handling callbacks for the application.
*
diff --git a/composer.json b/composer.json
index 5c00524..132c780 100644
--- a/composer.json
+++ b/composer.json
@@ -15,8 +15,9 @@
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
- "kwaadpepper/crud-policies": "^0.1.9",
- "kwaadpepper/enum": "^0.1.4",
+ "kwaadpepper/crud-policies": "^0.1.18",
+ "kwaadpepper/enum": "^2.1",
+ "kwaadpepper/exception-handler": "^0.0.3",
"laravel-lang/lang": "~8.0",
"laravel/framework": "^8.12",
"laravel/tinker": "^2.5",
@@ -27,7 +28,8 @@
"fakerphp/faker": "^1.9.1",
"mockery/mockery": "^1.4.2",
"nunomaduro/collision": "^5.0",
- "phpunit/phpunit": "^9.3.3"
+ "phpunit/phpunit": "^9.3.3",
+ "slevomat/coding-standard": "^7.0"
},
"config": {
"optimize-autoloader": true,
diff --git a/composer.lock b/composer.lock
index 9207fc2..9df634c 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": "0da9cba25dcff87fac2343ef3effa795",
+ "content-hash": "c32404ecdf12c6d1eca2e714cb65bbb6",
"packages": [
{
"name": "asm89/stack-cors",
@@ -1449,27 +1449,28 @@
},
{
"name": "kwaadpepper/crud-policies",
- "version": "0.1.9",
+ "version": "0.1.18",
"source": {
"type": "git",
"url": "https://github.com/Kwaadpepper/crud-policies.git",
- "reference": "cb0c3848fe252a4211891f907df387f746bd9750"
+ "reference": "a8ad75e1ef6e2aac00a45426bebb0b61fac03ba0"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Kwaadpepper/crud-policies/zipball/cb0c3848fe252a4211891f907df387f746bd9750",
- "reference": "cb0c3848fe252a4211891f907df387f746bd9750",
+ "url": "https://api.github.com/repos/Kwaadpepper/crud-policies/zipball/a8ad75e1ef6e2aac00a45426bebb0b61fac03ba0",
+ "reference": "a8ad75e1ef6e2aac00a45426bebb0b61fac03ba0",
"shasum": ""
},
"require": {
"facade/flare-client-php": "^1.8",
"illuminate/support": "~7|~8",
- "kwaadpepper/enum": "^0.1.4",
+ "kwaadpepper/enum": "^2.0",
"laravel/framework": "~7|~8"
},
"require-dev": {
"orchestra/testbench": "^6.13",
"phpunit/phpunit": "~9.0",
+ "slevomat/coding-standard": "^7.0",
"squizlabs/php_codesniffer": "^3.5"
},
"type": "library",
@@ -1506,31 +1507,32 @@
],
"support": {
"issues": "https://github.com/Kwaadpepper/crud-policies/issues",
- "source": "https://github.com/Kwaadpepper/crud-policies/tree/0.1.9"
+ "source": "https://github.com/Kwaadpepper/crud-policies/tree/0.1.18"
},
- "time": "2021-07-27T08:58:38+00:00"
+ "time": "2021-09-15T08:55:36+00:00"
},
{
"name": "kwaadpepper/enum",
- "version": "0.1.4",
+ "version": "2.1.1",
"source": {
"type": "git",
"url": "https://github.com/Kwaadpepper/enum.git",
- "reference": "f9e2b960d86ceea45c905f11c0c5699529e32848"
+ "reference": "1c342113b63d15c8b30e5d8a0af5d4d750392037"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Kwaadpepper/enum/zipball/f9e2b960d86ceea45c905f11c0c5699529e32848",
- "reference": "f9e2b960d86ceea45c905f11c0c5699529e32848",
+ "url": "https://api.github.com/repos/Kwaadpepper/enum/zipball/1c342113b63d15c8b30e5d8a0af5d4d750392037",
+ "reference": "1c342113b63d15c8b30e5d8a0af5d4d750392037",
"shasum": ""
},
"require": {
- "illuminate/support": "~7|~8",
- "laravel/framework": "~7|~8"
+ "php": "^7.3"
},
"require-dev": {
- "orchestra/testbench": "^6.13",
+ "orchestra/testbench": "^5",
+ "phpunit/php-code-coverage": "^9.2",
"phpunit/phpunit": "~9.0",
+ "slevomat/coding-standard": "^7.0",
"squizlabs/php_codesniffer": "^3.5"
},
"type": "library",
@@ -1565,9 +1567,70 @@
],
"support": {
"issues": "https://github.com/Kwaadpepper/enum/issues",
- "source": "https://github.com/Kwaadpepper/enum/tree/0.1.4"
+ "source": "https://github.com/Kwaadpepper/enum/tree/2.1.1"
},
- "time": "2021-04-06T14:35:59+00:00"
+ "time": "2021-09-20T20:37:21+00:00"
+ },
+ {
+ "name": "kwaadpepper/exception-handler",
+ "version": "0.0.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Kwaadpepper/exception-handler.git",
+ "reference": "979e8add45fea601b221e95595366fb446e8c6b7"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Kwaadpepper/exception-handler/zipball/979e8add45fea601b221e95595366fb446e8c6b7",
+ "reference": "979e8add45fea601b221e95595366fb446e8c6b7",
+ "shasum": ""
+ },
+ "require": {
+ "illuminate/support": "~7|~8",
+ "laravel/framework": "~7|~8"
+ },
+ "require-dev": {
+ "orchestra/testbench": "^6.13",
+ "phpunit/phpunit": "~9.0",
+ "squizlabs/php_codesniffer": "^3.5"
+ },
+ "type": "library",
+ "extra": {
+ "laravel": {
+ "providers": [
+ "Kwaadpepper\\ExceptionHandler\\ExceptionHandlerServiceProvider"
+ ]
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Kwaadpepper\\ExceptionHandler\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jérémy Munsch",
+ "email": "github@jeremydev.ovh",
+ "homepage": "https://jeremydev.ovh"
+ }
+ ],
+ "description": "Send emails when exceptions occurs",
+ "homepage": "https://github.com/kwaadpepper/exception-handler",
+ "keywords": [
+ "email",
+ "exception",
+ "laravel",
+ "policies"
+ ],
+ "support": {
+ "issues": "https://github.com/Kwaadpepper/exception-handler/issues",
+ "source": "https://github.com/Kwaadpepper/exception-handler/tree/0.0.3"
+ },
+ "time": "2021-09-15T17:06:33+00:00"
},
{
"name": "laravel-lang/lang",
@@ -5712,6 +5775,76 @@
}
],
"packages-dev": [
+ {
+ "name": "dealerdirect/phpcodesniffer-composer-installer",
+ "version": "v0.7.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git",
+ "reference": "fe390591e0241955f22eb9ba327d137e501c771c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/fe390591e0241955f22eb9ba327d137e501c771c",
+ "reference": "fe390591e0241955f22eb9ba327d137e501c771c",
+ "shasum": ""
+ },
+ "require": {
+ "composer-plugin-api": "^1.0 || ^2.0",
+ "php": ">=5.3",
+ "squizlabs/php_codesniffer": "^2.0 || ^3.0 || ^4.0"
+ },
+ "require-dev": {
+ "composer/composer": "*",
+ "phpcompatibility/php-compatibility": "^9.0",
+ "sensiolabs/security-checker": "^4.1.0"
+ },
+ "type": "composer-plugin",
+ "extra": {
+ "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin"
+ },
+ "autoload": {
+ "psr-4": {
+ "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Franck Nijhof",
+ "email": "franck.nijhof@dealerdirect.com",
+ "homepage": "http://www.frenck.nl",
+ "role": "Developer / IT Manager"
+ }
+ ],
+ "description": "PHP_CodeSniffer Standards Composer Installer Plugin",
+ "homepage": "http://www.dealerdirect.com",
+ "keywords": [
+ "PHPCodeSniffer",
+ "PHP_CodeSniffer",
+ "code quality",
+ "codesniffer",
+ "composer",
+ "installer",
+ "phpcs",
+ "plugin",
+ "qa",
+ "quality",
+ "standard",
+ "standards",
+ "style guide",
+ "stylecheck",
+ "tests"
+ ],
+ "support": {
+ "issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues",
+ "source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer"
+ },
+ "time": "2020-12-07T18:04:37+00:00"
+ },
{
"name": "doctrine/instantiator",
"version": "1.4.0",
@@ -6598,6 +6731,55 @@
},
"time": "2021-03-17T13:42:18+00:00"
},
+ {
+ "name": "phpstan/phpdoc-parser",
+ "version": "0.5.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpstan/phpdoc-parser.git",
+ "reference": "ea0b17460ec38e20d7eb64e7ec49b5d44af5d28c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/ea0b17460ec38e20d7eb64e7ec49b5d44af5d28c",
+ "reference": "ea0b17460ec38e20d7eb64e7ec49b5d44af5d28c",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1 || ^8.0"
+ },
+ "require-dev": {
+ "php-parallel-lint/php-parallel-lint": "^1.2",
+ "phpstan/extension-installer": "^1.0",
+ "phpstan/phpstan": "^0.12.87",
+ "phpstan/phpstan-strict-rules": "^0.12.5",
+ "phpunit/phpunit": "^9.5",
+ "symfony/process": "^5.2"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "0.5-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "PHPStan\\PhpDocParser\\": [
+ "src/"
+ ]
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "PHPDoc parser with support for nullable, intersection and generic types",
+ "support": {
+ "issues": "https://github.com/phpstan/phpdoc-parser/issues",
+ "source": "https://github.com/phpstan/phpdoc-parser/tree/0.5.5"
+ },
+ "time": "2021-06-11T13:24:46+00:00"
+ },
{
"name": "phpunit/php-code-coverage",
"version": "9.2.6",
@@ -7984,6 +8166,123 @@
],
"time": "2020-09-28T06:39:44+00:00"
},
+ {
+ "name": "slevomat/coding-standard",
+ "version": "7.0.13",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/slevomat/coding-standard.git",
+ "reference": "122a9bf9a4a2195f74100f47dfb8375982f43cc9"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/122a9bf9a4a2195f74100f47dfb8375982f43cc9",
+ "reference": "122a9bf9a4a2195f74100f47dfb8375982f43cc9",
+ "shasum": ""
+ },
+ "require": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7",
+ "php": "^7.1 || ^8.0",
+ "phpstan/phpdoc-parser": "0.5.1 - 0.5.5",
+ "squizlabs/php_codesniffer": "^3.6.0"
+ },
+ "require-dev": {
+ "phing/phing": "2.16.4",
+ "php-parallel-lint/php-parallel-lint": "1.3.0",
+ "phpstan/phpstan": "0.12.93",
+ "phpstan/phpstan-deprecation-rules": "0.12.6",
+ "phpstan/phpstan-phpunit": "0.12.21",
+ "phpstan/phpstan-strict-rules": "0.12.10",
+ "phpunit/phpunit": "7.5.20|8.5.5|9.5.7"
+ },
+ "type": "phpcodesniffer-standard",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "7.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "SlevomatCodingStandard\\": "SlevomatCodingStandard"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.",
+ "support": {
+ "issues": "https://github.com/slevomat/coding-standard/issues",
+ "source": "https://github.com/slevomat/coding-standard/tree/7.0.13"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/kukulich",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/slevomat/coding-standard",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2021-07-29T14:30:22+00:00"
+ },
+ {
+ "name": "squizlabs/php_codesniffer",
+ "version": "3.6.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
+ "reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ffced0d2c8fa8e6cdc4d695a743271fab6c38625",
+ "reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625",
+ "shasum": ""
+ },
+ "require": {
+ "ext-simplexml": "*",
+ "ext-tokenizer": "*",
+ "ext-xmlwriter": "*",
+ "php": ">=5.4.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
+ },
+ "bin": [
+ "bin/phpcs",
+ "bin/phpcbf"
+ ],
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.x-dev"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Greg Sherwood",
+ "role": "lead"
+ }
+ ],
+ "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
+ "homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
+ "keywords": [
+ "phpcs",
+ "standards"
+ ],
+ "support": {
+ "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues",
+ "source": "https://github.com/squizlabs/PHP_CodeSniffer",
+ "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki"
+ },
+ "time": "2021-04-09T00:54:41+00:00"
+ },
{
"name": "theseer/tokenizer",
"version": "1.2.1",
diff --git a/config/exception-handler.php b/config/exception-handler.php
new file mode 100644
index 0000000..e6bd69b
--- /dev/null
+++ b/config/exception-handler.php
@@ -0,0 +1,17 @@
+ !config('app.debug'),
+
+ /**
+ * Put a developper secured mailbox in here
+ * so you can receive email if things go mad
+ */
+ 'contactsList' => [
+ env('MAIL_LIST_SERVICEWEB', 'equipe.web@ldc.fr')
+ ]
+];
diff --git a/phpcs.xml b/phpcs.xml
index 87a8ec8..14acd89 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -80,6 +80,7 @@
date : {{ date('Y-m-d H:i:s') }}
-code : {{$exception->getCode() }}
-file : {{$exception->getFile() }}
-line : {{$exception->getLine() }}
-Veuillez vérifier les logs pour en voir la trace.
- - diff --git a/resources/views/ticket/show.blade.php b/resources/views/ticket/show.blade.php index c97aaf1..77c3c69 100644 --- a/resources/views/ticket/show.blade.php +++ b/resources/views/ticket/show.blade.php @@ -105,7 +105,7 @@ @if ($message->file !== null){!! Utils::plainToHtml($ticket->text) !!}
- Créé le {{ \Carbon\Carbon::parse($ticket->created_at)->format('d/m/Y à H:i') }} par {{ $ticket->user->name }} + Créé le {{ \Carbon\Carbon::parse($ticket->created_at)->format('d/m/Y à H:i') }} par {{ $ticket->user ? $ticket->user->name : __('Utilisateur supprimé') }}