diff --git a/app/Http/Requests/Expense/StoreExpenseRequest.php b/app/Http/Requests/Expense/StoreExpenseRequest.php index b08ee31f5d..0c964fef90 100644 --- a/app/Http/Requests/Expense/StoreExpenseRequest.php +++ b/app/Http/Requests/Expense/StoreExpenseRequest.php @@ -69,7 +69,7 @@ class StoreExpenseRequest extends Request /* Ensure the project is related */ if (array_key_exists('project_id', $input) && isset($input['project_id'])) { - $project = Project::withTrashed()->find($input['project_id'])->company()->first(); + $project = Project::withTrashed()->where('id', $input['project_id'])->company()->first(); if($project){ $input['client_id'] = $project->client_id; diff --git a/app/Http/Requests/Expense/UpdateExpenseRequest.php b/app/Http/Requests/Expense/UpdateExpenseRequest.php index aabe07f659..26b1447310 100644 --- a/app/Http/Requests/Expense/UpdateExpenseRequest.php +++ b/app/Http/Requests/Expense/UpdateExpenseRequest.php @@ -64,7 +64,7 @@ class UpdateExpenseRequest extends Request /* Ensure the project is related */ if (array_key_exists('project_id', $input) && isset($input['project_id'])) { - $project = Project::withTrashed()->find($input['project_id'])->company()->first(); + $project = Project::withTrashed()->where('id', $input['project_id'])->company()->first(); if($project){ $input['client_id'] = $project->client_id;