@@ -199,12 +199,12 @@ discard block |
||
199 | 199 | |
200 | 200 | protected function replacePlaceholders(string $description, ActivityContract $activity): string |
201 | 201 | { |
202 | - return preg_replace_callback('/:[a-z0-9._-]+/i', function ($match) use ($activity) { |
|
202 | + return preg_replace_callback('/:[a-z0-9._-]+/i', function($match) use ($activity) { |
|
203 | 203 | $match = $match[0]; |
204 | 204 | |
205 | 205 | $attribute = Str::before(Str::after($match, ':'), '.'); |
206 | 206 | |
207 | - if (! in_array($attribute, ['subject', 'causer', 'properties'])) { |
|
207 | + if (!in_array($attribute, ['subject', 'causer', 'properties'])) { |
|
208 | 208 | return $match; |
209 | 209 | } |
210 | 210 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | |
225 | 225 | protected function getActivity(): ActivityContract |
226 | 226 | { |
227 | - if (! $this->activity instanceof ActivityContract) { |
|
227 | + if (!$this->activity instanceof ActivityContract) { |
|
228 | 228 | $this->activity = ActivitylogServiceProvider::getActivityModelInstance(); |
229 | 229 | $this |
230 | 230 | ->useLog($this->defaultLogName) |
@@ -19,11 +19,11 @@ discard block |
||
19 | 19 | |
20 | 20 | public function __construct(array $attributes = []) |
21 | 21 | { |
22 | - if (! isset($this->connection)) { |
|
22 | + if (!isset($this->connection)) { |
|
23 | 23 | $this->setConnection(config('activitylog.database_connection')); |
24 | 24 | } |
25 | 25 | |
26 | - if (! isset($this->table)) { |
|
26 | + if (!isset($this->table)) { |
|
27 | 27 | $this->setTable(config('activitylog.table_name')); |
28 | 28 | } |
29 | 29 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | public function changes(): Collection |
53 | 53 | { |
54 | - if (! $this->properties instanceof Collection) { |
|
54 | + if (!$this->properties instanceof Collection) { |
|
55 | 55 | return new Collection(); |
56 | 56 | } |
57 | 57 |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | $this->mergeConfigFrom(__DIR__.'/../config/activitylog.php', 'activitylog'); |
21 | 21 | |
22 | - if (! class_exists('CreateActivityLogTable')) { |
|
22 | + if (!class_exists('CreateActivityLogTable')) { |
|
23 | 23 | $timestamp = date('Y_m_d_His', time()); |
24 | 24 | |
25 | 25 | $this->publishes([ |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | { |
46 | 46 | $activityModel = config('activitylog.activity_model') ?? ActivityModel::class; |
47 | 47 | |
48 | - if (! is_a($activityModel, Activity::class, true) |
|
49 | - || ! is_a($activityModel, Model::class, true)) { |
|
48 | + if (!is_a($activityModel, Activity::class, true) |
|
49 | + || !is_a($activityModel, Model::class, true)) { |
|
50 | 50 | throw InvalidConfiguration::modelIsNotValid($activityModel); |
51 | 51 | } |
52 | 52 |
@@ -3,7 +3,7 @@ |
||
3 | 3 | use Spatie\Activitylog\ActivityLogger; |
4 | 4 | use Spatie\Activitylog\ActivityLogStatus; |
5 | 5 | |
6 | -if (! function_exists('activity')) { |
|
6 | +if (!function_exists('activity')) { |
|
7 | 7 | function activity(string $logName = null): ActivityLogger |
8 | 8 | { |
9 | 9 | $defaultLogName = config('activitylog.default_log_name'); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | protected static function bootDetectsChanges() |
15 | 15 | { |
16 | 16 | if (static::eventsToBeRecorded()->contains('updated')) { |
17 | - static::updating(function (Model $model) { |
|
17 | + static::updating(function(Model $model) { |
|
18 | 18 | |
19 | 19 | //temporary hold the original attributes on the model |
20 | 20 | //as we'll need these in the updating event |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | public function shouldLogOnlyDirty(): bool |
62 | 62 | { |
63 | - if (! isset(static::$logOnlyDirty)) { |
|
63 | + if (!isset(static::$logOnlyDirty)) { |
|
64 | 64 | return false; |
65 | 65 | } |
66 | 66 | |
@@ -69,11 +69,11 @@ discard block |
||
69 | 69 | |
70 | 70 | public function shouldLogUnguarded(): bool |
71 | 71 | { |
72 | - if (! isset(static::$logUnguarded)) { |
|
72 | + if (!isset(static::$logUnguarded)) { |
|
73 | 73 | return false; |
74 | 74 | } |
75 | 75 | |
76 | - if (! static::$logUnguarded) { |
|
76 | + if (!static::$logUnguarded) { |
|
77 | 77 | return false; |
78 | 78 | } |
79 | 79 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | public function attributeValuesToBeLogged(string $processingEvent): array |
88 | 88 | { |
89 | - if (! count($this->attributesToBeLogged())) { |
|
89 | + if (!count($this->attributesToBeLogged())) { |
|
90 | 90 | return []; |
91 | 91 | } |
92 | 92 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $properties['attributes'] = array_udiff_assoc( |
113 | 113 | $properties['attributes'], |
114 | 114 | $properties['old'], |
115 | - function ($new, $old) { |
|
115 | + function($new, $old) { |
|
116 | 116 | if ($old === null || $new === null) { |
117 | 117 | return $new === $old ? 0 : 1; |
118 | 118 | } |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | |
20 | 20 | protected static function bootLogsActivity() |
21 | 21 | { |
22 | - static::eventsToBeRecorded()->each(function ($eventName) { |
|
23 | - return static::$eventName(function (Model $model) use ($eventName) { |
|
24 | - if (! $model->shouldLogEvent($eventName)) { |
|
22 | + static::eventsToBeRecorded()->each(function($eventName) { |
|
23 | + return static::$eventName(function(Model $model) use ($eventName) { |
|
24 | + if (!$model->shouldLogEvent($eventName)) { |
|
25 | 25 | return; |
26 | 26 | } |
27 | 27 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | $attrs = $model->attributeValuesToBeLogged($eventName); |
37 | 37 | |
38 | - if ($model->isLogEmpty($attrs) && ! $model->shouldSubmitEmptyLogs()) { |
|
38 | + if ($model->isLogEmpty($attrs) && !$model->shouldSubmitEmptyLogs()) { |
|
39 | 39 | return; |
40 | 40 | } |
41 | 41 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | public function shouldSubmitEmptyLogs(): bool |
57 | 57 | { |
58 | - return ! isset(static::$submitEmptyLogs) ? true : static::$submitEmptyLogs; |
|
58 | + return !isset(static::$submitEmptyLogs) ? true : static::$submitEmptyLogs; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | public function isLogEmpty($attrs): bool |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | public function attributesToBeIgnored(): array |
122 | 122 | { |
123 | - if (! isset(static::$ignoreChangedAttributes)) { |
|
123 | + if (!isset(static::$ignoreChangedAttributes)) { |
|
124 | 124 | return []; |
125 | 125 | } |
126 | 126 | |
@@ -131,11 +131,11 @@ discard block |
||
131 | 131 | { |
132 | 132 | $logStatus = app(ActivityLogStatus::class); |
133 | 133 | |
134 | - if (! $this->enableLoggingModelsEvents || $logStatus->disabled()) { |
|
134 | + if (!$this->enableLoggingModelsEvents || $logStatus->disabled()) { |
|
135 | 135 | return false; |
136 | 136 | } |
137 | 137 | |
138 | - if (! in_array($eventName, ['created', 'updated'])) { |
|
138 | + if (!in_array($eventName, ['created', 'updated'])) { |
|
139 | 139 | return true; |
140 | 140 | } |
141 | 141 |
@@ -27,7 +27,7 @@ |
||
27 | 27 | $activity = ActivitylogServiceProvider::getActivityModelInstance(); |
28 | 28 | |
29 | 29 | $amountDeleted = $activity::where('created_at', '<', $cutOffDate) |
30 | - ->when($log !== null, function (Builder $query) use ($log) { |
|
30 | + ->when($log !== null, function(Builder $query) use ($log) { |
|
31 | 31 | $query->inLog($log); |
32 | 32 | }) |
33 | 33 | ->delete(); |