From 733bc0bfa4aee604be1910b705e23099976cdd36 Mon Sep 17 00:00:00 2001 From: chapdel Date: Thu, 19 Nov 2020 11:37:18 +0100 Subject: [PATCH] Add frontend guard --- app/Http/Controllers/UserController.php | 2 +- app/Models/User.php | 2 +- app/Providers/AppServiceProvider.php | 9 +- composer.json | 8 +- package-lock.json | 11 +- package.json | 1 + public/js/app.js | 602 ++++++++++++++++++++++-- resources/js/Layouts/AppLayout.vue | 1 + resources/js/app.js | 19 + 9 files changed, 608 insertions(+), 47 deletions(-) diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index d023e2e..6afe70e 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -16,7 +16,7 @@ class UserController extends Controller public function index() { - return Inertia::render('Users/Index', ['users' => User::where('id', '<>', auth()->id())->get()]); + return Inertia::render('Users/Index', ['users' => User::where('id', '<>', auth()->id())->orderBy('created_at', 'desc')->get()]); } /** diff --git a/app/Models/User.php b/app/Models/User.php index 03975a7..43ab66f 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -63,6 +63,6 @@ class User extends Authenticatable public function lists() { - return $this->hasMany(Lists:class); + return $this->hasMany(Lists::class); } } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index a43bab6..bf5858e 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -4,6 +4,7 @@ use Illuminate\Support\Facades\Schema; use Illuminate\Support\ServiceProvider; +use Inertia\Inertia; class AppServiceProvider extends ServiceProvider { @@ -14,7 +15,13 @@ class AppServiceProvider extends ServiceProvider */ public function register() { - // + Inertia::share([ + 'auth' => function () { + return [ + 'roles' => auth()->user() ? auth()->user()->roles->pluck('name') : null + ]; + } +]); } /** diff --git a/composer.json b/composer.json index 9794aea..ab751a9 100644 --- a/composer.json +++ b/composer.json @@ -1,10 +1,10 @@ { - "name": "laravel/laravel", + "name": "chapdel/notchrelay", "type": "project", - "description": "The Laravel Framework.", + "description": "Free email marketing tool.", "keywords": [ - "framework", - "laravel" + "newsletter", + "email" ], "license": "MIT", "require": { diff --git a/package-lock.json b/package-lock.json index 9091579..4abd189 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1106,6 +1106,14 @@ "integrity": "sha512-q5CfxAzNg12qsvI75h+bh5RlvKViNu7zmWbpnb6D0VUA2asbxjlJcMXpaMKXZt1U5fP6ti8NiTJgFy35vs2vOQ==", "dev": true }, + "@inertiajs/progress": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/@inertiajs/progress/-/progress-0.2.2.tgz", + "integrity": "sha512-hUPPLCdcos1Y9pIJVlCRp8VgQ3rkvLGdGLuLQN4qrCnmzI3ri2NSvXAuqf2Ce8x4p2UlquNRkPFydCgutwF82w==", + "requires": { + "nprogress": "^0.2.0" + } + }, "@mrmlnc/readdir-enhanced": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz", @@ -6114,8 +6122,7 @@ "nprogress": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/nprogress/-/nprogress-0.2.0.tgz", - "integrity": "sha1-y480xTIT2JVyP8urkH6UIq28r7E=", - "dev": true + "integrity": "sha1-y480xTIT2JVyP8urkH6UIq28r7E=" }, "nth-check": { "version": "1.0.2", diff --git a/package.json b/package.json index 92f3bfc..25c308d 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "vue-template-compiler": "^2.6.10" }, "dependencies": { + "@inertiajs/progress": "^0.2.2", "moment-timezone": "^0.5.32", "vue-moment": "^4.1.0", "vue-tailwind": "^1.3.3" diff --git a/public/js/app.js b/public/js/app.js index 43c723b..c0fde29 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -110,6 +110,19 @@ var e,t=(e=__webpack_require__(/*! axios */ "./node_modules/axios/index.js"))&&" //# sourceMappingURL=index.js.map +/***/ }), + +/***/ "./node_modules/@inertiajs/progress/dist/index.js": +/*!********************************************************!*\ + !*** ./node_modules/@inertiajs/progress/dist/index.js ***! + \********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var n,e=(n=__webpack_require__(/*! nprogress */ "./node_modules/nprogress/nprogress.js"))&&"object"==typeof n&&"default"in n?n.default:n,t=null;function r(n){document.addEventListener("inertia:start",o.bind(null,n)),document.addEventListener("inertia:progress",i),document.addEventListener("inertia:finish",s)}function o(n){t=setTimeout(function(){return e.start()},n)}function i(n){e.isStarted()&&n.detail.progress.percentage&&e.set(Math.max(e.status,n.detail.progress.percentage/100*.9))}function s(n){clearTimeout(t),e.isStarted()&&(n.detail.visit.completed?e.done():n.detail.visit.interrupted?e.set(0):n.detail.visit.cancelled&&(e.done(),e.remove()))}exports.InertiaProgress={init:function(n){var t=void 0===n?{}:n,o=t.delay,i=t.color,s=void 0===i?"#29d":i,a=t.includeCSS,p=void 0===a||a,d=t.showSpinner,l=void 0!==d&&d;r(void 0===o?250:o),e.configure({showSpinner:l}),p&&function(n){var e=document.createElement("style");e.type="text/css",e.textContent="\n #nprogress {\n pointer-events: none;\n }\n\n #nprogress .bar {\n background: "+n+";\n\n position: fixed;\n z-index: 1031;\n top: 0;\n left: 0;\n\n width: 100%;\n height: 2px;\n }\n\n #nprogress .peg {\n display: block;\n position: absolute;\n right: 0px;\n width: 100px;\n height: 100%;\n box-shadow: 0 0 10px "+n+", 0 0 5px "+n+";\n opacity: 1.0;\n\n -webkit-transform: rotate(3deg) translate(0px, -4px);\n -ms-transform: rotate(3deg) translate(0px, -4px);\n transform: rotate(3deg) translate(0px, -4px);\n }\n\n #nprogress .spinner {\n display: block;\n position: fixed;\n z-index: 1031;\n top: 15px;\n right: 15px;\n }\n\n #nprogress .spinner-icon {\n width: 18px;\n height: 18px;\n box-sizing: border-box;\n\n border: solid 2px transparent;\n border-top-color: "+n+";\n border-left-color: "+n+";\n border-radius: 50%;\n\n -webkit-animation: nprogress-spinner 400ms linear infinite;\n animation: nprogress-spinner 400ms linear infinite;\n }\n\n .nprogress-custom-parent {\n overflow: hidden;\n position: relative;\n }\n\n .nprogress-custom-parent #nprogress .spinner,\n .nprogress-custom-parent #nprogress .bar {\n position: absolute;\n }\n\n @-webkit-keyframes nprogress-spinner {\n 0% { -webkit-transform: rotate(0deg); }\n 100% { -webkit-transform: rotate(360deg); }\n }\n @keyframes nprogress-spinner {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n ",document.head.appendChild(e)}(s)}}; +//# sourceMappingURL=index.js.map + + /***/ }), /***/ "./node_modules/axios/index.js": @@ -3422,6 +3435,7 @@ __webpack_require__.r(__webpack_exports__); // // // +// @@ -45801,6 +45815,493 @@ webpackContext.id = "./node_modules/moment/locale sync recursive ^\\.\\/.*$"; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module))) +/***/ }), + +/***/ "./node_modules/nprogress/nprogress.js": +/*!*********************************************!*\ + !*** ./node_modules/nprogress/nprogress.js ***! + \*********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress + * @license MIT */ + +;(function(root, factory) { + + if (true) { + !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory), + __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? + (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : + __WEBPACK_AMD_DEFINE_FACTORY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } else {} + +})(this, function() { + var NProgress = {}; + + NProgress.version = '0.2.0'; + + var Settings = NProgress.settings = { + minimum: 0.08, + easing: 'ease', + positionUsing: '', + speed: 200, + trickle: true, + trickleRate: 0.02, + trickleSpeed: 800, + showSpinner: true, + barSelector: '[role="bar"]', + spinnerSelector: '[role="spinner"]', + parent: 'body', + template: '
' + }; + + /** + * Updates configuration. + * + * NProgress.configure({ + * minimum: 0.1 + * }); + */ + NProgress.configure = function(options) { + var key, value; + for (key in options) { + value = options[key]; + if (value !== undefined && options.hasOwnProperty(key)) Settings[key] = value; + } + + return this; + }; + + /** + * Last number. + */ + + NProgress.status = null; + + /** + * Sets the progress bar status, where `n` is a number from `0.0` to `1.0`. + * + * NProgress.set(0.4); + * NProgress.set(1.0); + */ + + NProgress.set = function(n) { + var started = NProgress.isStarted(); + + n = clamp(n, Settings.minimum, 1); + NProgress.status = (n === 1 ? null : n); + + var progress = NProgress.render(!started), + bar = progress.querySelector(Settings.barSelector), + speed = Settings.speed, + ease = Settings.easing; + + progress.offsetWidth; /* Repaint */ + + queue(function(next) { + // Set positionUsing if it hasn't already been set + if (Settings.positionUsing === '') Settings.positionUsing = NProgress.getPositioningCSS(); + + // Add transition + css(bar, barPositionCSS(n, speed, ease)); + + if (n === 1) { + // Fade out + css(progress, { + transition: 'none', + opacity: 1 + }); + progress.offsetWidth; /* Repaint */ + + setTimeout(function() { + css(progress, { + transition: 'all ' + speed + 'ms linear', + opacity: 0 + }); + setTimeout(function() { + NProgress.remove(); + next(); + }, speed); + }, speed); + } else { + setTimeout(next, speed); + } + }); + + return this; + }; + + NProgress.isStarted = function() { + return typeof NProgress.status === 'number'; + }; + + /** + * Shows the progress bar. + * This is the same as setting the status to 0%, except that it doesn't go backwards. + * + * NProgress.start(); + * + */ + NProgress.start = function() { + if (!NProgress.status) NProgress.set(0); + + var work = function() { + setTimeout(function() { + if (!NProgress.status) return; + NProgress.trickle(); + work(); + }, Settings.trickleSpeed); + }; + + if (Settings.trickle) work(); + + return this; + }; + + /** + * Hides the progress bar. + * This is the *sort of* the same as setting the status to 100%, with the + * difference being `done()` makes some placebo effect of some realistic motion. + * + * NProgress.done(); + * + * If `true` is passed, it will show the progress bar even if its hidden. + * + * NProgress.done(true); + */ + + NProgress.done = function(force) { + if (!force && !NProgress.status) return this; + + return NProgress.inc(0.3 + 0.5 * Math.random()).set(1); + }; + + /** + * Increments by a random amount. + */ + + NProgress.inc = function(amount) { + var n = NProgress.status; + + if (!n) { + return NProgress.start(); + } else { + if (typeof amount !== 'number') { + amount = (1 - n) * clamp(Math.random() * n, 0.1, 0.95); + } + + n = clamp(n + amount, 0, 0.994); + return NProgress.set(n); + } + }; + + NProgress.trickle = function() { + return NProgress.inc(Math.random() * Settings.trickleRate); + }; + + /** + * Waits for all supplied jQuery promises and + * increases the progress as the promises resolve. + * + * @param $promise jQUery Promise + */ + (function() { + var initial = 0, current = 0; + + NProgress.promise = function($promise) { + if (!$promise || $promise.state() === "resolved") { + return this; + } + + if (current === 0) { + NProgress.start(); + } + + initial++; + current++; + + $promise.always(function() { + current--; + if (current === 0) { + initial = 0; + NProgress.done(); + } else { + NProgress.set((initial - current) / initial); + } + }); + + return this; + }; + + })(); + + /** + * (Internal) renders the progress bar markup based on the `template` + * setting. + */ + + NProgress.render = function(fromStart) { + if (NProgress.isRendered()) return document.getElementById('nprogress'); + + addClass(document.documentElement, 'nprogress-busy'); + + var progress = document.createElement('div'); + progress.id = 'nprogress'; + progress.innerHTML = Settings.template; + + var bar = progress.querySelector(Settings.barSelector), + perc = fromStart ? '-100' : toBarPerc(NProgress.status || 0), + parent = document.querySelector(Settings.parent), + spinner; + + css(bar, { + transition: 'all 0 linear', + transform: 'translate3d(' + perc + '%,0,0)' + }); + + if (!Settings.showSpinner) { + spinner = progress.querySelector(Settings.spinnerSelector); + spinner && removeElement(spinner); + } + + if (parent != document.body) { + addClass(parent, 'nprogress-custom-parent'); + } + + parent.appendChild(progress); + return progress; + }; + + /** + * Removes the element. Opposite of render(). + */ + + NProgress.remove = function() { + removeClass(document.documentElement, 'nprogress-busy'); + removeClass(document.querySelector(Settings.parent), 'nprogress-custom-parent'); + var progress = document.getElementById('nprogress'); + progress && removeElement(progress); + }; + + /** + * Checks if the progress bar is rendered. + */ + + NProgress.isRendered = function() { + return !!document.getElementById('nprogress'); + }; + + /** + * Determine which positioning CSS rule to use. + */ + + NProgress.getPositioningCSS = function() { + // Sniff on document.body.style + var bodyStyle = document.body.style; + + // Sniff prefixes + var vendorPrefix = ('WebkitTransform' in bodyStyle) ? 'Webkit' : + ('MozTransform' in bodyStyle) ? 'Moz' : + ('msTransform' in bodyStyle) ? 'ms' : + ('OTransform' in bodyStyle) ? 'O' : ''; + + if (vendorPrefix + 'Perspective' in bodyStyle) { + // Modern browsers with 3D support, e.g. Webkit, IE10 + return 'translate3d'; + } else if (vendorPrefix + 'Transform' in bodyStyle) { + // Browsers without 3D support, e.g. IE9 + return 'translate'; + } else { + // Browsers without translate() support, e.g. IE7-8 + return 'margin'; + } + }; + + /** + * Helpers + */ + + function clamp(n, min, max) { + if (n < min) return min; + if (n > max) return max; + return n; + } + + /** + * (Internal) converts a percentage (`0..1`) to a bar translateX + * percentage (`-100%..0%`). + */ + + function toBarPerc(n) { + return (-1 + n) * 100; + } + + + /** + * (Internal) returns the correct CSS for changing the bar's + * position given an n percentage, and speed and ease from Settings + */ + + function barPositionCSS(n, speed, ease) { + var barCSS; + + if (Settings.positionUsing === 'translate3d') { + barCSS = { transform: 'translate3d('+toBarPerc(n)+'%,0,0)' }; + } else if (Settings.positionUsing === 'translate') { + barCSS = { transform: 'translate('+toBarPerc(n)+'%,0)' }; + } else { + barCSS = { 'margin-left': toBarPerc(n)+'%' }; + } + + barCSS.transition = 'all '+speed+'ms '+ease; + + return barCSS; + } + + /** + * (Internal) Queues a function to be executed. + */ + + var queue = (function() { + var pending = []; + + function next() { + var fn = pending.shift(); + if (fn) { + fn(next); + } + } + + return function(fn) { + pending.push(fn); + if (pending.length == 1) next(); + }; + })(); + + /** + * (Internal) Applies css properties to an element, similar to the jQuery + * css method. + * + * While this helper does assist with vendor prefixed property names, it + * does not perform any manipulation of values prior to setting styles. + */ + + var css = (function() { + var cssPrefixes = [ 'Webkit', 'O', 'Moz', 'ms' ], + cssProps = {}; + + function camelCase(string) { + return string.replace(/^-ms-/, 'ms-').replace(/-([\da-z])/gi, function(match, letter) { + return letter.toUpperCase(); + }); + } + + function getVendorProp(name) { + var style = document.body.style; + if (name in style) return name; + + var i = cssPrefixes.length, + capName = name.charAt(0).toUpperCase() + name.slice(1), + vendorName; + while (i--) { + vendorName = cssPrefixes[i] + capName; + if (vendorName in style) return vendorName; + } + + return name; + } + + function getStyleProp(name) { + name = camelCase(name); + return cssProps[name] || (cssProps[name] = getVendorProp(name)); + } + + function applyCss(element, prop, value) { + prop = getStyleProp(prop); + element.style[prop] = value; + } + + return function(element, properties) { + var args = arguments, + prop, + value; + + if (args.length == 2) { + for (prop in properties) { + value = properties[prop]; + if (value !== undefined && properties.hasOwnProperty(prop)) applyCss(element, prop, value); + } + } else { + applyCss(element, args[1], args[2]); + } + } + })(); + + /** + * (Internal) Determines if an element or space separated list of class names contains a class name. + */ + + function hasClass(element, name) { + var list = typeof element == 'string' ? element : classList(element); + return list.indexOf(' ' + name + ' ') >= 0; + } + + /** + * (Internal) Adds a class to an element. + */ + + function addClass(element, name) { + var oldList = classList(element), + newList = oldList + name; + + if (hasClass(oldList, name)) return; + + // Trim the opening space. + element.className = newList.substring(1); + } + + /** + * (Internal) Removes a class from an element. + */ + + function removeClass(element, name) { + var oldList = classList(element), + newList; + + if (!hasClass(element, name)) return; + + // Replace the class name. + newList = oldList.replace(' ' + name + ' ', ' '); + + // Trim the opening and closing spaces. + element.className = newList.substring(1, newList.length - 1); + } + + /** + * (Internal) Gets a space separated list of the class names on the element. + * The list is wrapped with a single space on each end to facilitate finding + * matches within the list. + */ + + function classList(element) { + return (' ' + (element.className || '') + ' ').replace(/\s+/gi, ' '); + } + + /** + * (Internal) Removes an element from the DOM. + */ + + function removeElement(element) { + element && element.parentNode && element.parentNode.removeChild(element); + } + + return NProgress; +}); + + + /***/ }), /***/ "./node_modules/portal-vue/dist/portal-vue.common.js": @@ -48952,52 +49453,59 @@ var render = function() { ] ), _vm._v(" "), - _c( - "li", - { - staticClass: "px-2 py-3 hover:bg-gray-900 rounded", - class: _vm.route().current("users") ? "bg-gray-900" : "" - }, - [ - _c( - "a", + _vm.hasRole("Super-Admin") || + _vm.hasRole("Super Admin") || + _vm.hasRole("Admin") || + _vm.hasRole("admin") + ? _c( + "li", { - staticClass: "flex items-center", - attrs: { href: _vm.route("users") } + staticClass: "px-2 py-3 hover:bg-gray-900 rounded", + class: _vm.route().current("users") ? "bg-gray-900" : "" }, [ _c( - "svg", + "a", { - staticClass: "w-6 text-gray-500", - attrs: { - fill: "none", - "stroke-linecap": "round", - "stroke-linejoin": "round", - "stroke-width": "2", - viewBox: "0 0 24 24", - stroke: "currentColor" - } + staticClass: "flex items-center", + attrs: { href: _vm.route("users") } }, [ - _c("path", { - attrs: { - d: - "M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z" - } - }) + _c( + "svg", + { + staticClass: "w-6 text-gray-500", + attrs: { + fill: "none", + "stroke-linecap": "round", + "stroke-linejoin": "round", + "stroke-width": "2", + viewBox: "0 0 24 24", + stroke: "currentColor" + } + }, + [ + _c("path", { + attrs: { + d: + "M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z" + } + }) + ] + ), + _vm._v(" "), + _c( + "span", + { + staticClass: "mx-2 text-gray-300 hidden md:block" + }, + [_vm._v("Users")] + ) ] - ), - _vm._v(" "), - _c( - "span", - { staticClass: "mx-2 text-gray-300 hidden md:block" }, - [_vm._v("Users")] ) ] ) - ] - ) + : _vm._e() ]) ]) ]), @@ -96182,8 +96690,10 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var _relay_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./relay.js */ "./resources/js/relay.js"); /* harmony import */ var vue_moment__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! vue-moment */ "./node_modules/vue-moment/dist/vue-moment.js"); /* harmony import */ var vue_moment__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(vue_moment__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var moment_timezone__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! moment-timezone */ "./node_modules/moment-timezone/index.js"); -/* harmony import */ var moment_timezone__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(moment_timezone__WEBPACK_IMPORTED_MODULE_8__); +/* harmony import */ var moment_timezone__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! moment-timezone */ "./node_modules/moment-timezone/index.js"); +/* harmony import */ var moment_timezone__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(moment_timezone__WEBPACK_IMPORTED_MODULE_7__); +/* harmony import */ var _inertiajs_progress__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @inertiajs/progress */ "./node_modules/@inertiajs/progress/dist/index.js"); +/* harmony import */ var _inertiajs_progress__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_inertiajs_progress__WEBPACK_IMPORTED_MODULE_8__); __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js"); __webpack_require__(/*! moment */ "./node_modules/moment/moment.js"); @@ -96196,12 +96706,28 @@ __webpack_require__(/*! moment */ "./node_modules/moment/moment.js"); -vue__WEBPACK_IMPORTED_MODULE_0___default.a.use(vue_moment__WEBPACK_IMPORTED_MODULE_6___default.a, moment_timezone__WEBPACK_IMPORTED_MODULE_8___default.a); + +_inertiajs_progress__WEBPACK_IMPORTED_MODULE_8__["InertiaProgress"].init({ + // The color of the progress bar. + color: '#29d', + // Whether to include the default NProgress styles. + includeCSS: true, + // Whether the NProgress spinner will be shown. + showSpinner: false +}); +vue__WEBPACK_IMPORTED_MODULE_0___default.a.use(vue_moment__WEBPACK_IMPORTED_MODULE_6___default.a, moment_timezone__WEBPACK_IMPORTED_MODULE_7___default.a); vue__WEBPACK_IMPORTED_MODULE_0___default.a.mixin({ methods: { route: route } }); +vue__WEBPACK_IMPORTED_MODULE_0___default.a.mixin({ + methods: { + hasRole: function hasRole(role) { + return this.$page.auth.roles.includes(role); + } + } +}); vue__WEBPACK_IMPORTED_MODULE_0___default.a.use(_inertiajs_inertia_vue__WEBPACK_IMPORTED_MODULE_1__["InertiaApp"]); vue__WEBPACK_IMPORTED_MODULE_0___default.a.use(laravel_jetstream__WEBPACK_IMPORTED_MODULE_2__["InertiaForm"]); vue__WEBPACK_IMPORTED_MODULE_0___default.a.use(portal_vue__WEBPACK_IMPORTED_MODULE_3___default.a); diff --git a/resources/js/Layouts/AppLayout.vue b/resources/js/Layouts/AppLayout.vue index f297e4e..8714888 100644 --- a/resources/js/Layouts/AppLayout.vue +++ b/resources/js/Layouts/AppLayout.vue @@ -440,6 +440,7 @@