From 238416748cac5f91712ad2105abf40e9b86023a3 Mon Sep 17 00:00:00 2001 From: "Md. Anichur Rahaman" <38912435+anis3139@users.noreply.github.com> Date: Tue, 7 Mar 2023 15:12:23 +0600 Subject: [PATCH] Add Remove button --- Http/Controllers/StripeController.php | 19 ++++++++++++- Http/routes.php | 3 +- Resources/views/stripe_settings.blade.php | 34 +++++++++++++++-------- composer.json | 2 +- 4 files changed, 44 insertions(+), 14 deletions(-) diff --git a/Http/Controllers/StripeController.php b/Http/Controllers/StripeController.php index 72c9d94..7b7c489 100644 --- a/Http/Controllers/StripeController.php +++ b/Http/Controllers/StripeController.php @@ -42,7 +42,7 @@ public function index(Mailbox $mailbox) } /** - * Summary of update + * Update stripe key * @param Request $request * @return void */ @@ -69,4 +69,21 @@ public function update(Request $request, Mailbox $mailbox) return redirect()->route('stripe.settings', $mailbox->id); } + + /** + * Delete stripe key + * @param Request $request + * @return void + */ + public function destroy(Request $request, Mailbox $mailbox) + { + try { + $mailbox->stripeSetting()->delete(); + \Session::flash('flash_success_floating', __('Secret Key delete Successfully')); + } catch (DecryptException $th) { + \Session::flash('flash_error_floating', __($th->getMessage())); + } + + return redirect()->back(); + } } diff --git a/Http/routes.php b/Http/routes.php index 2698a5d..9387bde 100644 --- a/Http/routes.php +++ b/Http/routes.php @@ -2,5 +2,6 @@ Route::group(['middleware' => 'web', 'prefix' => \Helper::getSubdirectory(), 'namespace' => 'Modules\Stripe\Http\Controllers'], function () { Route::get('/stripe/settings/{mailbox}', 'StripeController@index')->name('stripe.settings'); - Route::post('/stripe/settings/{mailbox}', 'StripeController@update')->name('stripe.settings.update'); + Route::put('/stripe/settings/{mailbox}', 'StripeController@update')->name('stripe.settings.update'); + Route::delete('/stripe/settings/{mailbox}', 'StripeController@destroy')->name('stripe.settings.destroy'); }); diff --git a/Resources/views/stripe_settings.blade.php b/Resources/views/stripe_settings.blade.php index 5eab733..d77415e 100644 --- a/Resources/views/stripe_settings.blade.php +++ b/Resources/views/stripe_settings.blade.php @@ -18,16 +18,17 @@