mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Basic Laravel7 compatibility, starting getting Livewire going
This commit is contained in:
parent
8268aca9fc
commit
8e66abb926
|
@ -3,8 +3,12 @@
|
||||||
namespace App\Exceptions;
|
namespace App\Exceptions;
|
||||||
|
|
||||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||||
|
use App\Helpers\Helper;
|
||||||
|
use Illuminate\Validation\ValidationException;
|
||||||
|
use Log;
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
|
||||||
|
|
||||||
class Handler extends ExceptionHandler
|
class Handler extends ExceptionHandler
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -17,6 +21,75 @@ class Handler extends ExceptionHandler
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Report or log an exception.
|
||||||
|
*
|
||||||
|
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
|
||||||
|
*
|
||||||
|
* @param \Throwable $exception
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function report(Throwable $exception)
|
||||||
|
{
|
||||||
|
if ($this->shouldReport($exception)) {
|
||||||
|
Log::error($exception);
|
||||||
|
return parent::report($exception);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render an exception into an HTTP response.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \Exception $e
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function render($request, Throwable $e)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
// CSRF token mismatch error
|
||||||
|
if ($e instanceof \Illuminate\Session\TokenMismatchException) {
|
||||||
|
return redirect()->back()->with('error', trans('general.token_expired'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Handle Ajax requests that fail because the model doesn't exist
|
||||||
|
if ($request->ajax() || $request->wantsJson()) {
|
||||||
|
|
||||||
|
if ($e instanceof \Illuminate\Database\Eloquent\ModelNotFoundException) {
|
||||||
|
$className = last(explode('\\', $e->getModel()));
|
||||||
|
return response()->json(Helper::formatStandardApiResponse('error', null, $className . ' not found'), 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->isHttpException($e)) {
|
||||||
|
|
||||||
|
$statusCode = $e->getStatusCode();
|
||||||
|
|
||||||
|
switch ($e->getStatusCode()) {
|
||||||
|
case '404':
|
||||||
|
return response()->json(Helper::formatStandardApiResponse('error', null, $statusCode . ' endpoint not found'), 404);
|
||||||
|
case '405':
|
||||||
|
return response()->json(Helper::formatStandardApiResponse('error', null, 'Method not allowed'), 405);
|
||||||
|
default:
|
||||||
|
return response()->json(Helper::formatStandardApiResponse('error', null, $statusCode), 405);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($this->isHttpException($e) && (isset($statusCode)) && ($statusCode == '404' )) {
|
||||||
|
return response()->view('layouts/basic', [
|
||||||
|
'content' => view('errors/404')
|
||||||
|
],$statusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::render($request, $e);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* A list of the inputs that are never flashed for validation exceptions.
|
* A list of the inputs that are never flashed for validation exceptions.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
|
|
|
@ -107,7 +107,9 @@
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"post-autoload-dump": [
|
"post-autoload-dump": [
|
||||||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump"
|
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||||
|
"@php artisan package:discover --ansi",
|
||||||
|
"@php artisan vendor:publish --force --tag=livewire:assets --ansi"
|
||||||
],
|
],
|
||||||
"post-create-project-cmd": [
|
"post-create-project-cmd": [
|
||||||
"php artisan key:generate"
|
"php artisan key:generate"
|
||||||
|
@ -120,4 +122,4 @@
|
||||||
"discard-changes": true,
|
"discard-changes": true,
|
||||||
"process-timeout": 3000
|
"process-timeout": 3000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
227
composer.lock
generated
227
composer.lock
generated
|
@ -544,6 +544,62 @@
|
||||||
],
|
],
|
||||||
"time": "2021-05-24T07:46:03+00:00"
|
"time": "2021-05-24T07:46:03+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "brick/math",
|
||||||
|
"version": "0.9.2",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/brick/math.git",
|
||||||
|
"reference": "dff976c2f3487d42c1db75a3b180e2b9f0e72ce0"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/brick/math/zipball/dff976c2f3487d42c1db75a3b180e2b9f0e72ce0",
|
||||||
|
"reference": "dff976c2f3487d42c1db75a3b180e2b9f0e72ce0",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-json": "*",
|
||||||
|
"php": "^7.1 || ^8.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"php-coveralls/php-coveralls": "^2.2",
|
||||||
|
"phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.0",
|
||||||
|
"vimeo/psalm": "4.3.2"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Brick\\Math\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"description": "Arbitrary-precision arithmetic library",
|
||||||
|
"keywords": [
|
||||||
|
"Arbitrary-precision",
|
||||||
|
"BigInteger",
|
||||||
|
"BigRational",
|
||||||
|
"arithmetic",
|
||||||
|
"bigdecimal",
|
||||||
|
"bignum",
|
||||||
|
"brick",
|
||||||
|
"math"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/brick/math/issues",
|
||||||
|
"source": "https://github.com/brick/math/tree/0.9.2"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/brick/math",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2021-01-20T22:51:39+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "defuse/php-encryption",
|
"name": "defuse/php-encryption",
|
||||||
"version": "v2.3.1",
|
"version": "v2.3.1",
|
||||||
|
@ -5112,6 +5168,94 @@
|
||||||
],
|
],
|
||||||
"time": "2021-04-09T13:38:32+00:00"
|
"time": "2021-04-09T13:38:32+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "nunomaduro/collision",
|
||||||
|
"version": "v4.3.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/nunomaduro/collision.git",
|
||||||
|
"reference": "7c125dc2463f3e144ddc7e05e63077109508c94e"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/nunomaduro/collision/zipball/7c125dc2463f3e144ddc7e05e63077109508c94e",
|
||||||
|
"reference": "7c125dc2463f3e144ddc7e05e63077109508c94e",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"facade/ignition-contracts": "^1.0",
|
||||||
|
"filp/whoops": "^2.4",
|
||||||
|
"php": "^7.2.5 || ^8.0",
|
||||||
|
"symfony/console": "^5.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"facade/ignition": "^2.0",
|
||||||
|
"fideloper/proxy": "^4.2",
|
||||||
|
"friendsofphp/php-cs-fixer": "^2.16",
|
||||||
|
"fruitcake/laravel-cors": "^1.0",
|
||||||
|
"laravel/framework": "^7.0",
|
||||||
|
"laravel/tinker": "^2.0",
|
||||||
|
"nunomaduro/larastan": "^0.6",
|
||||||
|
"orchestra/testbench": "^5.0",
|
||||||
|
"phpstan/phpstan": "^0.12.3",
|
||||||
|
"phpunit/phpunit": "^8.5.1 || ^9.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"providers": [
|
||||||
|
"NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"NunoMaduro\\Collision\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Nuno Maduro",
|
||||||
|
"email": "enunomaduro@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Cli error handling for console/command-line PHP applications.",
|
||||||
|
"keywords": [
|
||||||
|
"artisan",
|
||||||
|
"cli",
|
||||||
|
"command-line",
|
||||||
|
"console",
|
||||||
|
"error",
|
||||||
|
"handling",
|
||||||
|
"laravel",
|
||||||
|
"laravel-zero",
|
||||||
|
"php",
|
||||||
|
"symfony"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/nunomaduro/collision/issues",
|
||||||
|
"source": "https://github.com/nunomaduro/collision"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=66BYDWAT92N6L",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/nunomaduro",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://www.patreon.com/nunomaduro",
|
||||||
|
"type": "patreon"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2020-10-29T15:12:23+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "nyholm/psr7",
|
"name": "nyholm/psr7",
|
||||||
"version": "1.4.0",
|
"version": "1.4.0",
|
||||||
|
@ -9755,6 +9899,89 @@
|
||||||
],
|
],
|
||||||
"time": "2021-05-26T17:43:10+00:00"
|
"time": "2021-05-26T17:43:10+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/string",
|
||||||
|
"version": "v5.2.4",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/string.git",
|
||||||
|
"reference": "4e78d7d47061fa183639927ec40d607973699609"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/string/zipball/4e78d7d47061fa183639927ec40d607973699609",
|
||||||
|
"reference": "4e78d7d47061fa183639927ec40d607973699609",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=7.2.5",
|
||||||
|
"symfony/polyfill-ctype": "~1.8",
|
||||||
|
"symfony/polyfill-intl-grapheme": "~1.0",
|
||||||
|
"symfony/polyfill-intl-normalizer": "~1.0",
|
||||||
|
"symfony/polyfill-mbstring": "~1.0",
|
||||||
|
"symfony/polyfill-php80": "~1.15"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"symfony/error-handler": "^4.4|^5.0",
|
||||||
|
"symfony/http-client": "^4.4|^5.0",
|
||||||
|
"symfony/translation-contracts": "^1.1|^2",
|
||||||
|
"symfony/var-exporter": "^4.4|^5.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Component\\String\\": ""
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"Resources/functions.php"
|
||||||
|
],
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Nicolas Grekas",
|
||||||
|
"email": "p@tchwork.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"keywords": [
|
||||||
|
"grapheme",
|
||||||
|
"i18n",
|
||||||
|
"string",
|
||||||
|
"unicode",
|
||||||
|
"utf-8",
|
||||||
|
"utf8"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/symfony/string/tree/v5.2.4"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://symfony.com/sponsor",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/fabpot",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2021-02-16T10:20:28+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/translation",
|
"name": "symfony/translation",
|
||||||
"version": "v5.3.0",
|
"version": "v5.3.0",
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@livewireStyles
|
||||||
|
|
||||||
|
|
||||||
@if (($snipeSettings) && ($snipeSettings->header_color))
|
@if (($snipeSettings) && ($snipeSettings->header_color))
|
||||||
|
@ -74,6 +75,7 @@
|
||||||
|
|
||||||
|
|
||||||
@stack('js')
|
@stack('js')
|
||||||
|
@livewireScripts
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue