Logging for system logger

This commit is contained in:
David Bomba 2021-11-11 05:54:59 +11:00
parent a46f8d37c6
commit 906f2b30a4
4 changed files with 23 additions and 3 deletions

View File

@ -232,6 +232,7 @@ class Import implements ShouldQueue
$account = $this->company->account;
$account->default_company_id = $this->company->id;
$account->is_migrated = true;
$account->save();
//company size check

View File

@ -49,15 +49,19 @@ class SystemLogger implements ShouldQueue
public function handle() :void
{
if(!$this->company)
if(!$this->company){
nlog("SystemLogger:: No company");
return;
}
MultiDB::setDb($this->company->db);
$client_id = $this->client ? $this->client->id : null;
if(!$this->client && !$this->company->owner())
if(!$this->client && !$this->company->owner()){
nlog("SystemLogger:: could not find client and/or company owner");
return;
}
$user_id = $this->client ? $this->client->user_id : $this->company->owner()->id;
@ -71,9 +75,16 @@ class SystemLogger implements ShouldQueue
'type_id' => $this->type_id,
];
if(!$this->log)
if(!$this->log){
nlog("SystemLogger:: no log to store");
return;
}
SystemLog::create($sl);
}
public function failed($e)
{
nlog($e->getMessage());
}
}

View File

@ -3,9 +3,11 @@
namespace App\Mail;
use App\Models\Company;
use App\Utils\Ninja;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\App;
class MigrationCompleted extends Mailable
{
@ -33,6 +35,11 @@ class MigrationCompleted extends Mailable
*/
public function build()
{
App::forgetInstance('translator');
$t = app('translator');
$t->replace(Ninja::transformTranslations($this->company->settings));
$data['settings'] = $this->company->settings;
$data['company'] = $this->company->fresh();
$data['whitelabel'] = $this->company->account->isPaid() ? true : false;

View File

@ -82,6 +82,7 @@ class AccountTransformer extends EntityTransformer
'disable_auto_update' => (bool) config('ninja.disable_auto_update'),
'emails_sent' => (int) $account->emailsSent(),
'email_quota' => (int) $account->getDailyEmailLimit(),
'is_migrated' => (bool) $account->is_migrated,
];
}