Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix order activity timeline blank entries #1317

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a9b87f7
Updating docs versions
glennjacobs Sep 22, 2023
072ad32
Check if the user is null when logging out
dewebdesigns Sep 23, 2023
fbe1639
Fixes #1261
alecritson Sep 27, 2023
a256047
Merge pull request #1274 from lunarphp/hotfix/fix-scout-db-empty-search
alecritson Sep 27, 2023
1f25964
Check if the user is null when logging out #1269
alecritson Sep 28, 2023
a226892
Format config files more in line with the Laravel skeleton (#1273)
adevade Sep 28, 2023
3b1c248
Cover situation when all of discount isnt actually able to be used (#…
ryanmitchell Sep 29, 2023
ecb29f1
Allow section to be null on attributes (#1259)
netzknecht Sep 29, 2023
2a1c79a
Support blank and null coupons (#1293)
ryanmitchell Oct 6, 2023
73a2bc5
Fix duplicating product associations #1289 (#1291)
alecritson Oct 6, 2023
66a2541
Fix order create docs #1284 (#1292)
alecritson Oct 6, 2023
47b4c57
Discount documentation fixes (#1282)
NuktukDev Oct 6, 2023
3d31d11
Update PHPunit version (#1302)
alecritson Oct 12, 2023
9b18945
Don’t reset user on pricing manager (#1300)
alecritson Oct 12, 2023
e9e282c
Pass order object to mailer class during preview (#1299)
alecritson Oct 12, 2023
d7b6eac
Load attribute's default_value in hub when no existing value exists (…
kylekanderson Oct 16, 2023
44e0cf4
Update Order.php
wychoong Oct 28, 2023
8d46f3c
Update LogsActivity.php
wychoong Oct 28, 2023
eec3cdc
fix phpstan
wychoong Oct 28, 2023
5243e2f
Update Order.php
wychoong Nov 6, 2023
e89344e
Update LogsActivity.php
wychoong Nov 6, 2023
7147aef
Merge branch '0.7' into fix-order-activity-timeline-blank-entries
wychoong Dec 20, 2023
ae360ad
Merge branch '0.7' into fix-order-activity-timeline-blank-entries
alecritson Jan 11, 2024
e1ea9fd
Switch to methods for default logs
alecritson Jan 12, 2024
71a30f8
Update LogsActivity.php
alecritson Jan 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions packages/core/src/Base/Traits/LogsActivity.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@

namespace Lunar\Base\Traits;

use Illuminate\Support\Arr;
use Spatie\Activitylog\LogOptions;
use Spatie\Activitylog\Traits\LogsActivity as SpatieLogsActivity;

trait LogsActivity
{
use SpatieLogsActivity;

public static array $logExcept = [];

/**
* Get the log options for the activity log.
*/
Expand All @@ -17,7 +20,25 @@ public function getActivitylogOptions(): LogOptions
return LogOptions::defaults()
->useLogName('lunar')
->logAll()
->dontSubmitEmptyLogs()
->logExcept(['updated_at']);
->logExcept(array_merge(['updated_at'], static::getActivitylogExcept()))
->logOnlyDirty()
->dontSubmitEmptyLogs();
}

public static function addActivitylogExcept(array|string $fields)
{
$fields = Arr::wrap($fields);

static::$logExcept = array_merge(static::$logExcept, $fields);
}

public static function getDefaultLogExcept(): array
{
return [];
}

public static function getActivitylogExcept(): array
{
return array_merge(static::getDefaultLogExcept(), static::$logExcept);
}
}
7 changes: 7 additions & 0 deletions packages/core/src/Models/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,4 +244,11 @@ public function isPlaced(): bool
{
return ! blank($this->placed_at);
}

public static function getDefaultLogExcept(): array
{
return [
'status',
];
}
}
Loading