Fix Recurring implicit binding

This commit is contained in:
David Bomba 2019-05-03 11:30:08 +10:00
parent 7985315335
commit 7b62c50f90
3 changed files with 7 additions and 3 deletions

View File

@ -49,8 +49,8 @@ class RecurringInvoice extends BaseModel
]; ];
protected $with = [ protected $with = [
'client', // 'client',
'company', // 'company',
]; ];
public function company() public function company()

View File

@ -42,6 +42,10 @@ class RouteServiceProvider extends ServiceProvider
return \App\Models\Invoice::withTrashed()->where('id', $this->decodePrimaryKey($value))->firstOrFail(); 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) { Route::bind('quote', function ($value) {
return \App\Models\Quote::withTrashed()->where('id', $this->decodePrimaryKey($value))->firstOrFail(); return \App\Models\Quote::withTrashed()->where('id', $this->decodePrimaryKey($value))->firstOrFail();
}); });

View File

@ -160,7 +160,7 @@ class QuoteTest extends TestCase
$quote = Quote::where('user_id',$user->id)->first(); $quote = Quote::where('user_id',$user->id)->first();
$quote->settings = $client->getMergedSettings(); $quote->settings = $client->getMergedSettings();
$quote->save(); $quote->save();
Log::error(print_r($quote,1));
$response = $this->withHeaders([ $response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'), 'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $token, 'X-API-TOKEN' => $token,