diff --git a/app/Http/Controllers/ClientPortal/InvitationController.php b/app/Http/Controllers/ClientPortal/InvitationController.php index 1595b5483fea..490a60f31a34 100644 --- a/app/Http/Controllers/ClientPortal/InvitationController.php +++ b/app/Http/Controllers/ClientPortal/InvitationController.php @@ -80,7 +80,8 @@ class InvitationController extends Controller $entity_obj = 'App\Models\\'.ucfirst(Str::camel($entity)).'Invitation'; - $invitation = $entity_obj::where('key', $invitation_key) + $invitation = $entity_obj::withTrashed() + ->where('key', $invitation_key) ->whereHas($entity, function ($query) { $query->where('is_deleted',0); }) @@ -186,7 +187,8 @@ class InvitationController extends Controller $entity_obj = 'App\Models\\'.ucfirst(Str::camel($entity)).'Invitation'; - $invitation = $entity_obj::where('key', $invitation_key) + $invitation = $entity_obj::withTrashed() + ->where('key', $invitation_key) ->with('contact.client') ->firstOrFail(); @@ -228,7 +230,8 @@ class InvitationController extends Controller public function payInvoice(Request $request, string $invitation_key) { - $invitation = InvoiceInvitation::where('key', $invitation_key) + $invitation = InvoiceInvitation::withTrashed() + ->where('key', $invitation_key) ->with('contact.client') ->firstOrFail(); diff --git a/app/Http/Controllers/VendorPortal/InvitationController.php b/app/Http/Controllers/VendorPortal/InvitationController.php index 0d3d730f4b97..9f5f6ac93bb8 100644 --- a/app/Http/Controllers/VendorPortal/InvitationController.php +++ b/app/Http/Controllers/VendorPortal/InvitationController.php @@ -46,7 +46,8 @@ class InvitationController extends Controller Auth::logout(); - $invitation = PurchaseOrderInvitation::where('key', $invitation_key) + $invitation = PurchaseOrderInvitation::withTrashed() + ->where('key', $invitation_key) ->whereHas('purchase_order', function ($query) { $query->where('is_deleted',0); }) diff --git a/app/Http/Controllers/VendorPortal/PurchaseOrderController.php b/app/Http/Controllers/VendorPortal/PurchaseOrderController.php index 8b0b98e076ab..d3c4b3c651bc 100644 --- a/app/Http/Controllers/VendorPortal/PurchaseOrderController.php +++ b/app/Http/Controllers/VendorPortal/PurchaseOrderController.php @@ -141,6 +141,8 @@ class PurchaseOrderController extends Controller ->whereIn('id', $this->transformKeys($data['purchase_orders'])) ->where('company_id', auth()->guard('vendor')->user()->vendor->company_id) ->whereIn('status_id', [PurchaseOrder::STATUS_DRAFT, PurchaseOrder::STATUS_SENT]) + ->where('is_deleted', 0) + ->withTrashed() ->cursor()->each(function ($purchase_order){ $purchase_order->service() @@ -159,7 +161,7 @@ class PurchaseOrderController extends Controller if(count($data['purchase_orders']) == 1){ - $purchase_order = PurchaseOrder::whereIn('id', $this->transformKeys($data['purchase_orders']))->first(); + $purchase_order = PurchaseOrder::withTrashed()->where('is_deleted', 0)->whereIn('id', $this->transformKeys($data['purchase_orders']))->first(); return redirect()->route('vendor.purchase_order.show', ['purchase_order' => $purchase_order->hashed_id]);