Add logos to check data

This commit is contained in:
Hillel Coren 2018-05-08 18:34:11 +03:00
parent 755f125bf0
commit 97300d571d

View File

@ -87,6 +87,7 @@ class CheckData extends Command
$this->checkClientBalances();
$this->checkContacts();
$this->checkUserAccounts();
$this->checkLogoFiles();
if (! $this->option('client_id')) {
$this->checkOAuth();
@ -840,6 +841,30 @@ class CheckData extends Command
}
}
private function checkLogoFiles()
{
$accounts = DB::table('accounts')
->where('logo', '!=', '')
->orderBy('id')
->get(['logo']);
$countMissing = 0;
foreach ($accounts as $account) {
$path = public_path('logo/' . $account->logo);
if (! file_exists($path)) {
$this->logMessage('Missing file: ' . $account->logo);
$countMissing++;
}
}
if ($countMissing > 0) {
$this->isValid = false;
}
$this->logMessage($countMissing . ' missing logo files');
}
/**
* @return array
*/