Framework updates, merges from other packages
This commit is contained in:
parent
503b775c49
commit
619cabb751
@ -23,6 +23,26 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
//
|
// When a query should return 1 object, or FAIL if it doesnt
|
||||||
|
Builder::macro('singleOrFail',function () {
|
||||||
|
$result = $this->get();
|
||||||
|
|
||||||
|
if (($x=$result->count()) == 1) {
|
||||||
|
return $result->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \Exception(sprintf('Query brings back %d record(s) called for singleOrFail()',$x));
|
||||||
|
});
|
||||||
|
|
||||||
|
// When a query should return 1 object, or NULL if it doesnt
|
||||||
|
Builder::macro('single',function () {
|
||||||
|
$result = $this->get();
|
||||||
|
|
||||||
|
if ($result->count() == 1) {
|
||||||
|
return $result->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "laravel/laravel",
|
"name": "laravel/laravel",
|
||||||
|
"type": "project",
|
||||||
"description": "The Laravel Framework.",
|
"description": "The Laravel Framework.",
|
||||||
"keywords": ["framework", "laravel"],
|
"keywords": ["framework", "laravel"],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "project",
|
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^8.0",
|
"php": "^8.0",
|
||||||
"ext-sockets": "*",
|
"ext-sockets": "*",
|
||||||
@ -21,14 +21,20 @@
|
|||||||
"mockery/mockery": "^1.4.2",
|
"mockery/mockery": "^1.4.2",
|
||||||
"phpunit/phpunit": "^9.3.3"
|
"phpunit/phpunit": "^9.3.3"
|
||||||
},
|
},
|
||||||
|
"config": {
|
||||||
|
"optimize-autoloader": true,
|
||||||
|
"preferred-install": "dist",
|
||||||
|
"sort-packages": true
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"dont-discover": []
|
||||||
|
}
|
||||||
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"files": [
|
"files": [
|
||||||
"app/helpers.php"
|
"app/helpers.php"
|
||||||
],
|
],
|
||||||
"classmap": [
|
|
||||||
"database/seeds",
|
|
||||||
"database/factories"
|
|
||||||
],
|
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"App\\": "app/"
|
"App\\": "app/"
|
||||||
}
|
}
|
||||||
@ -38,29 +44,18 @@
|
|||||||
"Tests\\": "tests/"
|
"Tests\\": "tests/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"extra": {
|
"minimum-stability": "dev",
|
||||||
"laravel": {
|
"prefer-stable": true,
|
||||||
"dont-discover": [
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"post-autoload-dump": [
|
||||||
|
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||||
|
"@php artisan package:discover --ansi"
|
||||||
|
],
|
||||||
"post-root-package-install": [
|
"post-root-package-install": [
|
||||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||||
],
|
],
|
||||||
"post-create-project-cmd": [
|
"post-create-project-cmd": [
|
||||||
"@php artisan key:generate --ansi"
|
"@php artisan key:generate --ansi"
|
||||||
],
|
|
||||||
"post-autoload-dump": [
|
|
||||||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
|
||||||
"@php artisan package:discover --ansi"
|
|
||||||
]
|
]
|
||||||
},
|
}
|
||||||
"config": {
|
|
||||||
"preferred-install": "dist",
|
|
||||||
"sort-packages": true,
|
|
||||||
"optimize-autoloader": true
|
|
||||||
},
|
|
||||||
"minimum-stability": "dev",
|
|
||||||
"prefer-stable": true
|
|
||||||
}
|
}
|
||||||
|
22
package.json
22
package.json
@ -2,21 +2,17 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "npm run development",
|
"dev": "npm run development",
|
||||||
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
|
"development": "mix",
|
||||||
"watch": "npm run development -- --watch",
|
"watch": "mix watch",
|
||||||
"watch-poll": "npm run watch -- --watch-poll",
|
"watch-poll": "mix watch -- --watch-options-poll=1000",
|
||||||
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
|
"hot": "mix watch --hot",
|
||||||
"prod": "npm run production",
|
"prod": "npm run production",
|
||||||
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
|
"production": "mix --production"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"axios": "^0.18",
|
"axios": "^0.21",
|
||||||
"bootstrap": "^4.0.0",
|
"laravel-mix": "^6.0.6",
|
||||||
"cross-env": "^5.1",
|
"lodash": "^4.17.19",
|
||||||
"jquery": "^3.2",
|
"postcss": "^8.1.14"
|
||||||
"laravel-mix": "^2.0",
|
|
||||||
"lodash": "^4.17.5",
|
|
||||||
"popper.js": "^1.12",
|
|
||||||
"vue": "^2.5.17"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
32
resources/js/bootstrap.js
vendored
32
resources/js/bootstrap.js
vendored
@ -1,19 +1,5 @@
|
|||||||
|
|
||||||
window._ = require('lodash');
|
window._ = require('lodash');
|
||||||
|
|
||||||
/**
|
|
||||||
* We'll load jQuery and the Bootstrap jQuery plugin which provides support
|
|
||||||
* for JavaScript based Bootstrap features such as modals and tabs. This
|
|
||||||
* code may be modified to fit the specific needs of your application.
|
|
||||||
*/
|
|
||||||
|
|
||||||
try {
|
|
||||||
window.Popper = require('popper.js').default;
|
|
||||||
window.$ = window.jQuery = require('jquery');
|
|
||||||
|
|
||||||
require('bootstrap');
|
|
||||||
} catch (e) {}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We'll load the axios HTTP library which allows us to easily issue requests
|
* We'll load the axios HTTP library which allows us to easily issue requests
|
||||||
* to our Laravel back-end. This library automatically handles sending the
|
* to our Laravel back-end. This library automatically handles sending the
|
||||||
@ -24,27 +10,13 @@ window.axios = require('axios');
|
|||||||
|
|
||||||
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
|
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
|
||||||
|
|
||||||
/**
|
|
||||||
* Next we will register the CSRF Token as a common header with Axios so that
|
|
||||||
* all outgoing HTTP requests automatically have it attached. This is just
|
|
||||||
* a simple convenience so we don't have to attach every token manually.
|
|
||||||
*/
|
|
||||||
|
|
||||||
let token = document.head.querySelector('meta[name="csrf-token"]');
|
|
||||||
|
|
||||||
if (token) {
|
|
||||||
window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
|
|
||||||
} else {
|
|
||||||
console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Echo exposes an expressive API for subscribing to channels and listening
|
* Echo exposes an expressive API for subscribing to channels and listening
|
||||||
* for events that are broadcast by Laravel. Echo and event broadcasting
|
* for events that are broadcast by Laravel. Echo and event broadcasting
|
||||||
* allows your team to easily build robust real-time web applications.
|
* allows your team to easily build robust real-time web applications.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// import Echo from 'laravel-echo'
|
// import Echo from 'laravel-echo';
|
||||||
|
|
||||||
// window.Pusher = require('pusher-js');
|
// window.Pusher = require('pusher-js');
|
||||||
|
|
||||||
@ -52,5 +24,5 @@ if (token) {
|
|||||||
// broadcaster: 'pusher',
|
// broadcaster: 'pusher',
|
||||||
// key: process.env.MIX_PUSHER_APP_KEY,
|
// key: process.env.MIX_PUSHER_APP_KEY,
|
||||||
// cluster: process.env.MIX_PUSHER_APP_CLUSTER,
|
// cluster: process.env.MIX_PUSHER_APP_CLUSTER,
|
||||||
// encrypted: true
|
// forceTLS: true
|
||||||
// });
|
// });
|
||||||
|
Loading…
Reference in New Issue
Block a user