diff --git a/app/Http/Controllers/ProductController.php b/app/Http/Controllers/ProductController.php index dcc0ef4d5739..aa7bca103a89 100644 --- a/app/Http/Controllers/ProductController.php +++ b/app/Http/Controllers/ProductController.php @@ -406,9 +406,9 @@ class ProductController extends BaseController */ public function destroy(DestroyProductRequest $request, Product $product) { - $product = $this->product_repo->delete($product); + $this->product_repo->delete($product); - return $this->itemResponse($product); + return $this->itemResponse($product->fresh()); } /** diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index eceadd894f9f..f4cd530696a8 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -150,6 +150,16 @@ class Invoice extends BaseModel return $this->belongsTo(Company::class); } + public function project() + { + return $this->belongsTo(Project::class); + } + + public function design() + { + return $this->belongsTo(Design::class); + } + public function user() { return $this->belongsTo(User::class)->withTrashed(); diff --git a/app/Utils/HtmlEngine.php b/app/Utils/HtmlEngine.php index 20886313c118..1cdb6d855723 100644 --- a/app/Utils/HtmlEngine.php +++ b/app/Utils/HtmlEngine.php @@ -125,6 +125,9 @@ class HtmlEngine $data['$terms'] = &$data['$entity.terms']; $data['$view_link'] = ['value' => ''.ctrans('texts.view_invoice').'', 'label' => ctrans('texts.view_invoice')]; $data['$view_url'] = ['value' => $this->invitation->getLink(), 'label' => ctrans('texts.view_invoice')]; + + if($this->entity->project()->exists()) + $data['$project.name'] = ['value' => $this->entity->project->name, 'label' => ctrans('texts.project_name')]; } if ($this->entity_string == 'quote') {