crater
crater copied to clipboard
500 Error - No query results for model [Crater\Models\Currency].
Describe the bug
If a user deletes the initial company with company_id
of 1
, viewing report PDFs will result in a 500 error on all other companies.
[2022-07-30 00:03:36] production.ERROR: No query results for model [Crater\Models\Currency]. (View: /home/billing/billing.[redacted].com/resources/views/app/pdf/reports/sales-customers.blade.php) {"view":{"view":"/home/billing/billing.[redacted].com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php","data":[]},"userId":1,"exception":"[object] (Facade\\Ignition\\Exceptions\\ViewException(code: 0): No query results for model [Crater\\Models\\Currency]. (View: /home/billing/billing.[redacted].com/resources/views/app/pdf/reports/sales-customers.blade.php) at /home/billing/billing.[redacted].com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:444)
[stacktrace]
This is due to the following line https://github.com/crater-invoice/crater/blob/master/app/Space/helpers.php#L133
Screenshots
Please complete the following information:
- Crater version: 6.0.6, 7be59e7
- PHP version: 8.1
- Database type and version: MySQL 8.0
Optional info
- OS: Ubuntu 22.04
- Deployed with Laravel Forge with site isolation enabled
Also having this issue. Did you manage to resolve it?
Also having this issue. Did you manage to resolve it?
Since this happened on a freshly deployed install with nearly no data –and since I only needed one company– I just cleared the database and started over.
With that said I spun up a test server to see if changing all the company_id
entries in the DB back to 1
would work and it did, but I would not recommend it.
I think it's an on delete cascade issue but I'll take a look 👀
Any progress on this bug?