Remove static references

This commit is contained in:
James Cole
2023-10-29 06:33:43 +01:00
parent 075d459b7c
commit 4f2159b54d
205 changed files with 1287 additions and 1287 deletions

View File

@@ -39,26 +39,26 @@ class TransactionJournalMetaFactory
*/
public function updateOrCreate(array $data): ?TransactionJournalMeta
{
//Log::debug('In updateOrCreate()');
//app('log')->debug('In updateOrCreate()');
$value = $data['data'];
/** @var TransactionJournalMeta|null $entry */
$entry = $data['journal']->transactionJournalMeta()->where('name', $data['name'])->first();
if (null === $value && null !== $entry) {
//Log::debug('Value is empty, delete meta value.');
//app('log')->debug('Value is empty, delete meta value.');
$entry->delete();
return null;
}
if ($data['data'] instanceof Carbon) {
Log::debug('Is a carbon object.');
app('log')->debug('Is a carbon object.');
$value = $data['data']->toW3cString();
}
if ('' === (string)$value) {
// Log::debug('Is an empty string.');
// app('log')->debug('Is an empty string.');
// don't store blank strings.
if (null !== $entry) {
Log::debug('Will not store empty strings, delete meta value');
app('log')->debug('Will not store empty strings, delete meta value');
$entry->delete();
}
@@ -66,13 +66,13 @@ class TransactionJournalMetaFactory
}
if (null === $entry) {
//Log::debug('Will create new object.');
Log::debug(sprintf('Going to create new meta-data entry to store "%s".', $data['name']));
//app('log')->debug('Will create new object.');
app('log')->debug(sprintf('Going to create new meta-data entry to store "%s".', $data['name']));
$entry = new TransactionJournalMeta();
$entry->transactionJournal()->associate($data['journal']);
$entry->name = $data['name'];
}
Log::debug('Will update value and return.');
app('log')->debug('Will update value and return.');
$entry->data = $value;
$entry->save();