Stripe coupon fix && general updates

This commit is contained in:
Dennis
2020-11-12 13:33:34 +01:00
parent 673bbf73be
commit b65526e040
33 changed files with 205 additions and 172 deletions

View File

@@ -2,11 +2,10 @@
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Http\Requests\Admin\DocumentationArticleRequest;
use App\Models\DocumentationCategory;
use App\Models\DocumentationItem;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\DocumentationCategory;
use App\Http\Requests\Admin\DocumentationArticleRequest;
class DocumentationArticleController extends Controller
{

View File

@@ -3,9 +3,8 @@
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Http\Requests\Admin\DocumentationCategoryRequest;
use App\Models\DocumentationCategory;
use Illuminate\Http\Request;
use App\Http\Requests\Admin\DocumentationCategoryRequest;
class DocumentationController extends Controller
{

View File

@@ -5,9 +5,10 @@ namespace App\Http\Controllers\Profile;
use Carbon\Carbon;
use App\Models\User;
use App\Models\Package;
use Illuminate\Support\Arr;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Arr;
use Stripe\Exception\InvalidRequestException;
class ProfileBillingController extends Controller
{
@@ -125,16 +126,22 @@ class ProfileBillingController extends Controller
}
// If the user is already subscribed to the default plan, we have to swap it. Otherwise create a new one.
if ($user->subscribed('default')) {
$user->subscription('default')->swap($planId);
} else {
if ($coupon = $request->input('coupon')) {
$user->newSubscription('default', $planId)
->withCoupon($coupon)
->create($user->defaultPaymentMethod()->id);
try {
if ($user->subscribed('default')) {
$user->subscription('default')->swap($planId);
} else {
$user->newSubscription('default', $planId)->create($user->defaultPaymentMethod()->id);
if ($coupon = $request->input('coupon')) {
$user->newSubscription('default', $planId)
->withCoupon($coupon)
->create($user->defaultPaymentMethod()->id);
} else {
$user->newSubscription('default', $planId)->create($user->defaultPaymentMethod()->id);
}
}
} catch (InvalidRequestException $exception) {
$error = $exception->getJsonBody();
return redirect()->route('profile.billing.index')->with('error', Arr::get($error, 'error.message'));
}
$user->package_id = $plan->id;

View File

@@ -4,7 +4,6 @@ namespace App\Http\Controllers\Profile;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Hash;
use App\Http\Requests\UserProfileRequest;
use App\Http\Resources\UserProfileResource;

View File

@@ -2,8 +2,6 @@
namespace App\Http\Controllers;
use App\Mail\Admin\Server\AdminServerCreatedEmail;
use App\Models\Server;
use App\Models\User;
use Illuminate\Http\Request;
use App\Jobs\Servers\CreateServer;
@@ -13,6 +11,7 @@ use Illuminate\Support\Facades\Mail;
use App\Http\Resources\ServerResource;
use App\Mail\Server\ServerCreatedEmail;
use App\Http\Requests\ServerUpdateRequest;
use App\Mail\Admin\Server\AdminServerCreatedEmail;
class ServerController extends Controller
{
@@ -54,7 +53,7 @@ class ServerController extends Controller
if (setting('receive_email_on_server_creation')) {
$admins = User::query()->where('role', User::ADMIN)->get();
foreach($admins as $admin){
foreach ($admins as $admin) {
Mail::to($admin)->send(new AdminServerCreatedEmail($request->user(), $server));
}
}

View File

@@ -3,12 +3,11 @@
namespace App\Http\Controllers;
use App\Models\Server;
use Illuminate\Support\Arr;
use Illuminate\Http\Request;
use App\Jobs\Sites\CreateSite;
use App\Jobs\Sites\DeleteSite;
use App\Http\Requests\SiteRequest;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\DB;
use App\Http\Resources\SiteResource;
use Illuminate\Support\Facades\Hash;

View File

@@ -2,11 +2,11 @@
namespace App\Http\Middleware;
use Illuminate\Http\Request;
use Inertia\Middleware;
use Illuminate\Support\Arr;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Session;
use Inertia\Middleware;
class HandleInertiaRequests extends Middleware
{
@@ -32,7 +32,7 @@ class HandleInertiaRequests extends Middleware
public function share(Request $request)
{
return array_merge(parent::share($request), [
'auth' => function () use($request) {
'auth' => function () use ($request) {
$package = auth()->user()->package ?? [];
$can = $package ? [

View File

@@ -4,12 +4,12 @@ namespace App\Jobs\Sites;
use App\Models\Site;
use App\Services\Ploi\Ploi;
use Illuminate\Support\Arr;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Support\Arr;
class CreateSite implements ShouldQueue
{

View File

@@ -2,12 +2,12 @@
namespace App\Mail\Admin\Server;
use App\Models\Server;
use App\Models\User;
use App\Models\Server;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class AdminServerCreatedEmail extends Mailable implements ShouldQueue
{

View File

@@ -3,8 +3,8 @@
namespace App\Models;
use App\Casts\Encrypted;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
use Illuminate\Database\Eloquent\Model;
class SiteSystemUser extends Model
{
@@ -32,7 +32,6 @@ class SiteSystemUser extends Model
static::creating(function (self $siteSystemUser) {
$siteSystemUser->user_name = strtolower(Str::random(10));
$siteSystemUser->ftp_password = Str::random();
});
}
}

View File

@@ -1,8 +1,8 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddKeyboardShortcutsToUsersTable extends Migration
{

View File

@@ -1,8 +1,8 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateDocumentationCategoriesTable extends Migration
{

View File

@@ -1,8 +1,8 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSiteSystemUsersTable extends Migration
{

View File

@@ -1,8 +1,8 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSiteSystemUserAttached extends Migration
{

View File

@@ -1,8 +1,8 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddRequiresPasswordForFtpToUsersTable extends Migration
{

35
public/js/31.js vendored
View File

@@ -347,10 +347,13 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
_this.$inertia.post(_this.route('profile.billing.update.card'), {
payment_method: paymentMethod,
billing_details: _this.billingDetails
}).then(function (response) {
_this.sending = false;
})["catch"](function (err) {
_this.sending = false;
}, {
onStart: function onStart() {
return _this.sending = true;
},
onFinish: function onFinish() {
return _this.sending = false;
}
});
}
@@ -365,14 +368,16 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
updatePlan: function updatePlan(id) {
var _this2 = this;
this.sending = true;
this.$inertia.post(this.route('profile.billing.update.plan'), {
plan: id,
coupon: this.coupon
}).then(function (response) {
_this2.sending = false;
})["catch"](function (err) {
_this2.sending = false;
}, {
onStart: function onStart() {
return _this2.sending = true;
},
onFinish: function onFinish() {
return _this2.sending = false;
}
});
},
confirmCancel: function confirmCancel() {
@@ -389,11 +394,13 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
cancel: function cancel() {
var _this4 = this;
this.sending = true;
this.$inertia["delete"](this.route('profile.billing.cancel.plan')).then(function (response) {
_this4.sending = false;
})["catch"](function (err) {
_this4.sending = false;
this.$inertia["delete"](this.route('profile.billing.cancel.plan'), {
onStart: function onStart() {
return _this4.sending = true;
},
onFinish: function onFinish() {
return _this4.sending = false;
}
});
},
getInvoices: function getInvoices() {

10
public/js/48.js vendored
View File

@@ -131,9 +131,13 @@ __webpack_require__.r(__webpack_exports__);
submit: function submit() {
var _this = this;
this.sending = true;
this.$inertia.patch(this.route('profile.update'), this.form).then(function () {
return _this.sending = false;
this.$inertia.patch(this.route('profile.update'), this.form, {
onStart: function onStart() {
return _this.sending = true;
},
onFinish: function onFinish() {
return _this.sending = false;
}
});
}
}

22
public/js/49.js vendored
View File

@@ -128,16 +128,20 @@ __webpack_require__.r(__webpack_exports__);
submit: function submit() {
var _this = this;
this.sending = false;
this.$inertia.patch(this.route('profile.security.update'), this.form).then(function (response) {
_this.sending = true;
this.$inertia.patch(this.route('profile.security.update'), this.form, {
onStart: function onStart() {
return _this.sending = true;
},
onFinish: function onFinish() {
_this.sending = false;
if (!Object.keys(_this.$page.props.errors).length) {
_this.form = {
current_password: null,
password: null,
password_confirmation: null
};
if (!Object.keys(_this.$page.props.errors).length) {
_this.form = {
current_password: null,
password: null,
password_confirmation: null
};
}
}
});
}

10
public/js/50.js vendored
View File

@@ -138,9 +138,13 @@ __webpack_require__.r(__webpack_exports__);
submit: function submit() {
var _this = this;
this.sending = true;
this.$inertia.patch(this.route('profile.settings.update'), this.form).then(function (response) {
_this.sending = false;
this.$inertia.patch(this.route('profile.settings.update'), this.form, {
onStart: function onStart() {
return _this.sending = true;
},
onFinish: function onFinish() {
return _this.sending = false;
}
});
}
}

10
public/js/67.js vendored
View File

@@ -64,14 +64,18 @@ __webpack_require__.r(__webpack_exports__);
submit: function submit() {
var _this = this;
this.sending = true;
this.$inertia.post(this.route('password-creation.start', {
email: this.email
}), {
password: this.form.password,
password_confirmation: this.form.password_confirmation
}).then(function () {
_this.sending = false;
}, {
onStart: function onStart() {
return _this.sending = true;
},
onFinish: function onFinish() {
return _this.sending = false;
}
});
}
}

10
public/js/68.js vendored
View File

@@ -64,9 +64,13 @@ __webpack_require__.r(__webpack_exports__);
submit: function submit() {
var _this = this;
this.sending = true;
this.$inertia.post(this.route('register'), this.form).then(function () {
_this.sending = false;
this.$inertia.post(this.route('register'), this.form, {
onStart: function onStart() {
return _this.sending = true;
},
onFinish: function onFinish() {
return _this.sending = false;
}
});
}
}

10
public/js/69.js vendored
View File

@@ -72,14 +72,18 @@ __webpack_require__.r(__webpack_exports__);
submit: function submit() {
var _this = this;
this.sending = true;
this.$inertia.post(this.route('password.update'), {
email: this.form.email,
token: this.token,
password: this.form.password,
password_confirmation: this.form.password_confirmation
}).then(function () {
_this.sending = false;
}, {
onStart: function onStart() {
return _this.sending = true;
},
onFinish: function onFinish() {
return _this.sending = false;
}
});
}
}

19
public/js/78.js vendored
View File

@@ -37,6 +37,11 @@ __webpack_require__.r(__webpack_exports__);
//
//
//
//
//
//
//
//
@@ -68,13 +73,17 @@ __webpack_require__.r(__webpack_exports__);
submit: function submit() {
var _this = this;
this.sending = true;
this.$inertia.post(this.route('login'), {
email: this.form.email,
password: this.form.password,
remember: this.form.remember
}).then(function () {
return _this.sending = false;
}, {
onStart: function onStart() {
return _this.sending = true;
},
onFinish: function onFinish() {
return _this.sending = false;
}
});
}
}
@@ -170,7 +179,7 @@ var render = function() {
block: ""
}
},
[_vm._v(_vm._s(_vm.__("Reset password")))]
[_vm._v(_vm._s(_vm.__("Reset password")) + "\n ")]
),
_vm._v(" "),
_vm.$page.props.settings.allow_registration
@@ -193,7 +202,7 @@ var render = function() {
block: ""
}
},
[_vm._v("Register")]
[_vm._v("Register\n ")]
)
: _vm._e()
],

2
public/js/app.js vendored
View File

@@ -43,7 +43,7 @@
/******/
/******/ // script path function
/******/ function jsonpScriptSrc(chunkId) {
/******/ return __webpack_require__.p + "js/" + ({}[chunkId]||chunkId) + ".js?id=" + {"0":"6eb6c6536cbed8938f93","1":"036bc93ad1cffe03c96e","2":"d2a49802291d427ca7c8","3":"a0f4c2f49863abbfe7f1","4":"27416beeac7dd90b6c9f","5":"fbfbcf45610d060d921e","6":"73fc0264b5cc06f5bd55","7":"140acb8c38018bb7c822","8":"800cf8f4ae1573afb58b","9":"02624062748a221e1b6a","10":"b595780ed64e26944581","11":"df06b1a535d8806055b1","12":"4f7af8d4fd1bb64e00eb","13":"b6c8a10e296cb17abec4","14":"5689f13594bbe5fdbc3d","15":"f8477af56d89087de9a1","16":"e0c2664cf52612b9bd2d","17":"bcdab5000a82c728e7f9","18":"d8e3ad96345fe8e4afda","19":"1a4bd1588a470e523f22","20":"335eb934468e7096df6d","21":"cbe3778af8f4248c876f","22":"b12ca72bb7c62c6b9630","23":"9e6d4e65d20f1f49cda2","24":"3f7e288607390fc1eaa2","25":"ccbb1bff0ab817028556","26":"4a9f39a08d92a65f04a2","27":"f27bdc03e4c908fa2f06","28":"b23bce944757db5374be","29":"2a08ca7a9cbebf388aeb","30":"a49d0e302f965a22d28d","31":"887d5d0fd5367b9b5e5a","32":"2b9a4d6183e96ad3b935","33":"9a8db6581ef9377e3e63","34":"07f49d4e778319da1022","35":"4c0c644051361fcaa9c3","36":"b70bbbcb5c906cf9b53d","37":"96f2da065f5811256e37","38":"6b76604456aa862ed33d","39":"80ab32bc65580c5182b6","40":"7593d03916fe5e07f64e","41":"cc5e313e8c42c6ed08aa","42":"9f3a959fff3688b43151","43":"6cbaf6dc1a1b795ead0f","44":"fd8de34d2f7e44b1d3a1","45":"026fbbd51c2b703ed981","46":"4a5fd31135e72546e1de","47":"441a57ca598380ec8a43","48":"f085e31c0200005cd38d","49":"5f6e24c654d05522e313","50":"41e3af00aadda2036038","51":"21a5ad16c9318416587d","52":"bd4daa6dbf911725c6bc","53":"ad3dfac514f00d194887","54":"24e588ab18461e348783","55":"d8aec6ee1a5781b6af87","56":"99dee147a9adbb340507","57":"6edfa2c75fb31a1195b8","58":"fcc08fc7e48e734ab2a7","59":"b736d0ac4880f045f12a","60":"7cc85b6cb3f60be021b4","61":"b39bcd32e03c012a816f","62":"d61b419c5b861c001670","63":"37ac4d3b25619e38fd90","64":"4f44b9f12add6be38b47","65":"a9de2950510b1bbb3ea1","66":"ee681a4a50dba9230df9","67":"6b787068fde1e6464596","68":"9caad723841dddfa13ae","69":"7f006e10ce6a9ea40908","70":"5c262f47c883d5c74a8d","71":"87e8edd3eba0a29944d5","72":"e88d92ed4b2efbbf1e86","73":"3174bd6a722bab7cc6e6","74":"fb29103b00712180c4b7","75":"3c12f6ff58ce2e22ee05","76":"6c85122b7fd55535796f","77":"ac563e59d325c5b4bdbc","78":"d61ce291b6fabaeafe0b","79":"069176fd73397f72a5c2","80":"5a8b8d6dfd61aeae151d"}[chunkId] + ""
/******/ return __webpack_require__.p + "js/" + ({}[chunkId]||chunkId) + ".js?id=" + {"0":"6eb6c6536cbed8938f93","1":"036bc93ad1cffe03c96e","2":"d2a49802291d427ca7c8","3":"a0f4c2f49863abbfe7f1","4":"27416beeac7dd90b6c9f","5":"fbfbcf45610d060d921e","6":"73fc0264b5cc06f5bd55","7":"140acb8c38018bb7c822","8":"800cf8f4ae1573afb58b","9":"02624062748a221e1b6a","10":"b595780ed64e26944581","11":"df06b1a535d8806055b1","12":"4f7af8d4fd1bb64e00eb","13":"b6c8a10e296cb17abec4","14":"5689f13594bbe5fdbc3d","15":"f8477af56d89087de9a1","16":"e0c2664cf52612b9bd2d","17":"bcdab5000a82c728e7f9","18":"d8e3ad96345fe8e4afda","19":"1a4bd1588a470e523f22","20":"335eb934468e7096df6d","21":"cbe3778af8f4248c876f","22":"b12ca72bb7c62c6b9630","23":"9e6d4e65d20f1f49cda2","24":"3f7e288607390fc1eaa2","25":"ccbb1bff0ab817028556","26":"4a9f39a08d92a65f04a2","27":"f27bdc03e4c908fa2f06","28":"b23bce944757db5374be","29":"2a08ca7a9cbebf388aeb","30":"a49d0e302f965a22d28d","31":"443fb652d0d033856436","32":"2b9a4d6183e96ad3b935","33":"9a8db6581ef9377e3e63","34":"07f49d4e778319da1022","35":"4c0c644051361fcaa9c3","36":"b70bbbcb5c906cf9b53d","37":"96f2da065f5811256e37","38":"6b76604456aa862ed33d","39":"80ab32bc65580c5182b6","40":"7593d03916fe5e07f64e","41":"cc5e313e8c42c6ed08aa","42":"9f3a959fff3688b43151","43":"6cbaf6dc1a1b795ead0f","44":"fd8de34d2f7e44b1d3a1","45":"026fbbd51c2b703ed981","46":"4a5fd31135e72546e1de","47":"441a57ca598380ec8a43","48":"699d52b71338effb04b5","49":"9c0d39c376f2cd53ed2f","50":"86600b10bae23b4ef330","51":"21a5ad16c9318416587d","52":"bd4daa6dbf911725c6bc","53":"ad3dfac514f00d194887","54":"24e588ab18461e348783","55":"d8aec6ee1a5781b6af87","56":"99dee147a9adbb340507","57":"6edfa2c75fb31a1195b8","58":"fcc08fc7e48e734ab2a7","59":"b736d0ac4880f045f12a","60":"7cc85b6cb3f60be021b4","61":"b39bcd32e03c012a816f","62":"d61b419c5b861c001670","63":"37ac4d3b25619e38fd90","64":"4f44b9f12add6be38b47","65":"a9de2950510b1bbb3ea1","66":"ee681a4a50dba9230df9","67":"8325349530a31bd5094a","68":"e6e4bb315f4d1a40b067","69":"e2914dd4dcf67db1a599","70":"5c262f47c883d5c74a8d","71":"87e8edd3eba0a29944d5","72":"e88d92ed4b2efbbf1e86","73":"3174bd6a722bab7cc6e6","74":"fb29103b00712180c4b7","75":"3c12f6ff58ce2e22ee05","76":"6c85122b7fd55535796f","77":"ac563e59d325c5b4bdbc","78":"b417ff0680afc876a404","79":"069176fd73397f72a5c2","80":"5a8b8d6dfd61aeae151d"}[chunkId] + ""
/******/ }
/******/
/******/ // The require function

View File

@@ -4,18 +4,23 @@
<form class="space-y-4" @submit.prevent="submit">
<h1 class="font-semibold text-center text-title">Login to {{ $page.props.settings.name }}</h1>
<FormInput :label="__('Email')" :errors="$page.props.errors.email" v-model="form.email" id="email" type="email" required />
<FormInput :label="__('Email')" :errors="$page.props.errors.email" v-model="form.email" id="email"
type="email" required/>
<FormInput :label="__('Password')" v-model="form.password" id="password" type="password" required />
<FormInput :label="__('Password')" v-model="form.password" id="password" type="password" required/>
<Button variant="primary" :disabled="sending" block>{{ __('Login') }}</Button>
<Button as="inertia-link" :disabled="sending" :href="route('password.request')" variant="secondary" block>{{ __('Reset password') }}</Button>
<Button as="inertia-link" :disabled="sending" :href="route('password.request')" variant="secondary"
block>{{ __('Reset password') }}
</Button>
<TextDivider v-if="$page.props.settings.allow_registration">{{ __('Or') }}</TextDivider>
<div class="space-y-3">
<Button as="inertia-link" :href="route('register')" variant="secondary" :disabled="sending" v-if="$page.props.settings.allow_registration" block>Register</Button>
<Button as="inertia-link" :href="route('register')" variant="secondary" :disabled="sending"
v-if="$page.props.settings.allow_registration" block>Register
</Button>
</div>
</form>
</Container>
@@ -23,43 +28,45 @@
</template>
<script>
import TextDivider from '@/components/TextDivider'
import FormInput from '@/components/forms/FormInput'
import Button from '@/components/Button'
import Container from '@/components/Container'
import TextDivider from '@/components/TextDivider'
import FormInput from '@/components/forms/FormInput'
import Button from '@/components/Button'
import Container from '@/components/Container'
export default {
metaInfo: { title: 'Login' },
export default {
metaInfo: {title: 'Login'},
components: {
TextDivider,
FormInput,
Button,
Container,
},
components: {
TextDivider,
FormInput,
Button,
Container,
},
props: {
errors: Object,
},
data() {
return {
sending: false,
form: {
email: null,
password: null,
remember: null,
},
}
},
methods: {
submit() {
this.sending = true
this.$inertia.post(this.route('login'), {
email: this.form.email,
password: this.form.password,
remember: this.form.remember,
}).then(() => this.sending = false)
props: {
errors: Object,
},
data() {
return {
sending: false,
form: {
email: null,
password: null,
remember: null,
},
}
},
methods: {
submit() {
this.$inertia.post(this.route('login'), {
email: this.form.email,
password: this.form.password,
remember: this.form.remember,
}, {
onStart: () => this.sending = true,
onFinish: () => this.sending = false,
})
},
}
},
}
</script>

View File

@@ -53,16 +53,15 @@
useNotification,
submit() {
this.sending = true
this.$inertia.post(this.route('password-creation.start', {
email: this.email
}), {
password: this.form.password,
password_confirmation: this.form.password_confirmation,
}).then(() => {
this.sending = false
})
}, {
onStart: () => this.sending = true,
onFinish: () => this.sending = false
});
},
},
}

View File

@@ -52,11 +52,10 @@
useNotification,
submit() {
this.sending = true
this.$inertia.post(this.route('register'), this.form).then(() => {
this.sending = false
})
this.$inertia.post(this.route('register'), this.form, {
onStart: () => this.sending = true,
onFinish: () => this.sending = false,
});
},
},
}

View File

@@ -61,16 +61,15 @@
useNotification,
submit() {
this.sending = true
this.$inertia.post(this.route('password.update'), {
email: this.form.email,
token: this.token,
password: this.form.password,
password_confirmation: this.form.password_confirmation,
}).then(() => {
this.sending = false
})
}, {
onStart: () => this.sending = true,
onFinish: () => this.sending = false,
});
},
},
}

View File

@@ -303,27 +303,20 @@
this.$inertia.post(this.route('profile.billing.update.card'), {
payment_method: paymentMethod,
billing_details: this.billingDetails
}).then((response) => {
this.sending = false;
}).catch((err) => {
this.sending = false;
}, {
onStart: () => this.sending = true,
onFinish: () => this.sending = false
});
}
},
updatePlan(id) {
this.sending = true;
this.$inertia.post(this.route('profile.billing.update.plan'), {
plan: id,
coupon: this.coupon
}).then((response) => {
this.sending = false;
}).catch((err) => {
this.sending = false;
}, {
onStart: () => this.sending = true,
onFinish: () => this.sending = false
});
},
@@ -336,12 +329,9 @@
},
cancel (){
this.sending = true;
this.$inertia.delete(this.route('profile.billing.cancel.plan')).then((response) => {
this.sending = false;
}).catch((err) => {
this.sending = false;
this.$inertia.delete(this.route('profile.billing.cancel.plan'), {
onStart: () => this.sending = true,
onFinish: () => this.sending = false,
});
},

View File

@@ -108,10 +108,10 @@
methods: {
submit(){
this.sending = true
this.$inertia.patch(this.route('profile.update'), this.form)
.then(() => this.sending = false)
this.$inertia.patch(this.route('profile.update'), this.form, {
onStart: () => this.sending = true,
onFinish: () => this.sending = false
});
}
},
}

View File

@@ -106,11 +106,10 @@
methods: {
submit() {
this.sending = false;
this.$inertia.patch(this.route('profile.security.update'), this.form)
.then(response => {
this.sending = true;
this.$inertia.patch(this.route('profile.security.update'), this.form, {
onStart: () => this.sending = true,
onFinish: () => {
this.sending = false;
if (!Object.keys(this.$page.props.errors).length) {
this.form = {
@@ -119,7 +118,8 @@
password_confirmation: null,
}
}
})
}
});
}
},
}

View File

@@ -116,12 +116,10 @@
methods: {
submit() {
this.sending = true;
this.$inertia.patch(this.route('profile.settings.update'), this.form)
.then(response => {
this.sending = false;
})
this.$inertia.patch(this.route('profile.settings.update'), this.form, {
onStart: () => this.sending = true,
onFinish: () => this.sending = false,
});
}
},
}

View File

@@ -27,7 +27,7 @@ Route::group(['prefix' => 'documentation', 'as' => 'documentation.'], function (
Route::get('{category}/edit', 'DocumentationController@edit')->name('edit');
Route::patch('{category}', 'DocumentationController@update')->name('update');
Route::group(['prefix' => 'articles', 'as' => 'articles.'], function(){
Route::group(['prefix' => 'articles', 'as' => 'articles.'], function () {
Route::get('/', 'DocumentationArticleController@index')->name('index');
Route::get('create', 'DocumentationArticleController@create')->name('create');
Route::post('/', 'DocumentationArticleController@store')->name('store');