From 7b62c50f90c934bc954d963307728c66ec56747d Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 3 May 2019 11:30:08 +1000 Subject: [PATCH] Fix Recurring implicit binding --- app/Models/RecurringInvoice.php | 4 ++-- app/Providers/RouteServiceProvider.php | 4 ++++ tests/Feature/QuoteTest.php | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/Models/RecurringInvoice.php b/app/Models/RecurringInvoice.php index 443c1437fcfa..cb2ad71021f7 100644 --- a/app/Models/RecurringInvoice.php +++ b/app/Models/RecurringInvoice.php @@ -49,8 +49,8 @@ class RecurringInvoice extends BaseModel ]; protected $with = [ - 'client', - 'company', + // 'client', + // 'company', ]; public function company() diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 7547c292e611..674ba882fe43 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -42,6 +42,10 @@ class RouteServiceProvider extends ServiceProvider return \App\Models\Invoice::withTrashed()->where('id', $this->decodePrimaryKey($value))->firstOrFail(); }); + Route::bind('recurring_invoice', function ($value) { + return \App\Models\RecurringInvoice::withTrashed()->where('id', $this->decodePrimaryKey($value))->firstOrFail(); + }); + Route::bind('quote', function ($value) { return \App\Models\Quote::withTrashed()->where('id', $this->decodePrimaryKey($value))->firstOrFail(); }); diff --git a/tests/Feature/QuoteTest.php b/tests/Feature/QuoteTest.php index 834dd56e018c..b8224d4dfc7c 100644 --- a/tests/Feature/QuoteTest.php +++ b/tests/Feature/QuoteTest.php @@ -160,7 +160,7 @@ class QuoteTest extends TestCase $quote = Quote::where('user_id',$user->id)->first(); $quote->settings = $client->getMergedSettings(); $quote->save(); - Log::error(print_r($quote,1)); + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $token,