Use of undefined constant NINJA_VERSION - assumed 'NINJA_VERSION'

I am starting to see errors like these in the cron jobs

Fri, 18 Oct 2019 15:00:02 +0000 Running SendRecurringInvoices…

In HasEvents.php line 114:

Use of undefined constant ACCOUNT_COMPANY_DETAILS - assumed ‘ACCOUNT_COMPANY_DETAILS’ (this will throw an Error in a future version of PHP)

Fri, 18 Oct 2019 15:30:01 +0000 Running SendReminders…

In HasEvents.php line 114:

Use of undefined constant STATUS_ACTIVE - assumed ‘STATUS_ACTIVE’ (this will throw an Error in a future version of PHP)

While trying to fix this, I tried composer install, artisan tasks such as route:cache/migrate But it made things worse and now the site will not even load!

laravel-error file show many errors like these:
Use of undefined constant NINJA_VERSION - assumed ‘NINJA_VERSION’ (this will throw an Error in a future version of PHP)
Use of undefined constant ENTITY_INVOICE - assumed ‘ENTITY_INVOICE’ (this will throw an Error in a future version of PHP)

Can you please help?

Okay, just replying to my own post, but I removed these three files from bootstrap/cache:
packages.php routes.php services.php

and all the errors are gone!

Not sure which step created those files and what the errors in those files are…

Okay, so this error reappeared when we created new invoices which invoked emails via the queue worker. No emails were sent and the queue worker was throwing errors. The following showed up in stacktrace.log

Use of undefined constant STATUS_ACTIVE - assumed 'STATUS_ACTIVE' (this will throw an Error in a future version of PHP): #0 /home/billing/public_html/vendor/laravel/framework/src/Illuminate/Queue/SerializesAndRestoresModelIdentifiers.php(53): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'Use of undefine...', '/home/billing/p...', 53, Array)
#1 /home/billing/public_html/vendor/laravel/framework/src/Illuminate/Queue/SerializesModels.php(41): App\Jobs\SendInvoiceEmail->getRestoredPropertyValue(Object(Illuminate\Contracts\Database\ModelIdentifier))
#2 [internal function]: App\Jobs\SendInvoiceEmail->__wakeup()
...

I deleted the bootstrap/cache files (packages.php and services.php) and restarted the background worker with
php artisan queue:restart

and the emails started working again.

Can anybody throw a light on this? Could this be laravel framework issue?

This is InvoiceNinja version v4.5.15 and php version 7.3 on Ubuntu 16.04 LTS.