1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-05 18:52:44 +01:00

Add destroy() methods in all controllers

This commit is contained in:
David Bomba 2021-01-17 15:28:03 +11:00
parent 8c8509ca40
commit c4bfb33dbf
16 changed files with 82 additions and 22 deletions

View File

@ -432,10 +432,11 @@ class ClientController extends BaseController
*/
public function destroy(DestroyClientRequest $request, Client $client)
{
//may not need these destroy routes as we are using actions to 'archive/delete'
$client->delete();
return response()->json([], 200);
$this->client_repo->delete($client);
return $this->itemResponse($client->fresh());
}
/**

View File

@ -421,7 +421,7 @@ class CompanyGatewayController extends BaseController
{
$company_gateway->delete();
return response()->json([], 200);
return $this->itemResponse($company_gateway->fresh());
}
/**

View File

@ -420,9 +420,9 @@ class CreditController extends BaseController
*/
public function destroy(DestroyCreditRequest $request, Credit $credit)
{
$credit->delete();
$this->credit_repository->delete($credit);
return response()->json([], 200);
return $this->itemResponse($credit->fresh());
}
/**

View File

@ -415,7 +415,7 @@ class DesignController extends BaseController
$design->delete();
$design->save();
return response()->json([], 200);
return $this->itemResponse($design->fresh());
}
/**

View File

@ -414,7 +414,7 @@ class GroupSettingController extends BaseController
{
$group_setting->delete();
return response()->json([], 200);
return $this->itemResponse($group_setting->fresh());
}
/**

View File

@ -451,9 +451,9 @@ class InvoiceController extends BaseController
*/
public function destroy(DestroyInvoiceRequest $request, Invoice $invoice)
{
$invoice->delete();
$this->invoice_repo->delete($invoice);
return response()->json([], 200);
return $this->itemResponse($invoice->fresh());
}
/**

View File

@ -397,7 +397,7 @@ class PaymentTermController extends BaseController
{
$payment_term->delete();
return response()->json([], 200);
return $this->itemResponse($payment_term->fresh());
}
/**

View File

@ -429,7 +429,7 @@ class ProjectController extends BaseController
$project->delete();
$project->save();
return response()->json([], 200);
return $this->itemResponse($project->fresh());
}
/**

View File

@ -441,9 +441,9 @@ class QuoteController extends BaseController
*/
public function destroy(DestroyQuoteRequest $request, Quote $quote)
{
$quote->delete();
$this->quote_repo->delete($quote);
return response()->json([], 200);
return $this->itemResponse($quote->fresh());
}
/**

View File

@ -426,9 +426,9 @@ class RecurringInvoiceController extends BaseController
*/
public function destroy(DestroyRecurringInvoiceRequest $request, RecurringInvoice $recurring_invoice)
{
$recurring_invoice->delete();
$this->recurring_invoice_repo->delete($recurring_invoice);
return response()->json([], 200);
return $this->itemResponse($recurring_invoice->fresh());
}

View File

@ -428,9 +428,9 @@ class RecurringQuoteController extends BaseController
*/
public function destroy(DestroyRecurringQuoteRequest $request, RecurringQuote $recurring_quote)
{
$recurring_quote->delete();
$this->recurring_quote_repo->delete($recurring_quote);
return response()->json([], 200);
return $this->itemResponse($recurring_quote->fresh());
}
/**

View File

@ -425,9 +425,9 @@ class TaskController extends BaseController
public function destroy(DestroyTaskRequest $request, Task $task)
{
//may not need these destroy routes as we are using actions to 'archive/delete'
$task->delete();
$this->task_repo->delete($task);
return response()->json([], 200);
return $this->itemResponse($task->fresh());
}
/**

View File

@ -400,7 +400,7 @@ class TaskStatusController extends BaseController
{
$task_status->delete();
return response()->json([], 200);
return $this->itemResponse($task_status->fresh());
}
/**

View File

@ -432,7 +432,7 @@ class VendorController extends BaseController
//may not need these destroy routes as we are using actions to 'archive/delete'
$vendor->delete();
return response()->json([], 200);
return $this->itemResponse($vendor->fresh());
}
/**

View File

@ -112,6 +112,8 @@ class WebhookHandler implements ShouldQueue
RequestOptions::JSON => $data, // or 'json' => [...]
]);
nlog($response);
if ($response->getStatusCode() == 410 || $response->getStatusCode() == 200) {
$subscription->delete();
}

View File

@ -0,0 +1,57 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class ChangeCustomSurchargeColumnType extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('invoices', function (Blueprint $table) {
$table->decimal('custom_surcharge1', 20,6)->change();
$table->decimal('custom_surcharge2', 20,6)->change();
$table->decimal('custom_surcharge3', 20,6)->change();
$table->decimal('custom_surcharge4', 20,6)->change();
});
Schema::table('recurring_invoices', function (Blueprint $table) {
$table->decimal('custom_surcharge1', 20,6)->change();
$table->decimal('custom_surcharge2', 20,6)->change();
$table->decimal('custom_surcharge3', 20,6)->change();
$table->decimal('custom_surcharge4', 20,6)->change();
});
Schema::table('quotes', function (Blueprint $table) {
$table->decimal('custom_surcharge1', 20,6)->change();
$table->decimal('custom_surcharge2', 20,6)->change();
$table->decimal('custom_surcharge3', 20,6)->change();
$table->decimal('custom_surcharge4', 20,6)->change();
});
Schema::table('credits', function (Blueprint $table) {
$table->decimal('custom_surcharge1', 20,6)->change();
$table->decimal('custom_surcharge2', 20,6)->change();
$table->decimal('custom_surcharge3', 20,6)->change();
$table->decimal('custom_surcharge4', 20,6)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}