tap() function returns error #931
Answered
by
Gummibeer
yangshengjie4u
asked this question in
Q&A
-
Here is my code in Controller,
However, it returns error when I call the erase(),
Any hints?Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
Gummibeer
Jul 19, 2021
Replies: 1 comment 1 reply
-
Hey, laravel-activitylog/src/ActivityLogger.php Lines 156 to 174 in 0da6f05 So you should change it to activity('Data record')
->causedBy(Auth::user()->id)
->tap(function(Activity $activity) use ($group, $gid) {
$activity->show_changes='Records under '.Data::find($id)->name.' are deleted';
})
->log('batch delete'); This will do what you expect it to do. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
yangshengjie4u
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey,
yes your
tap()
call is too late in the fluent chain. Thelog()
method doesn't return an instance of theActivityLogger
anymore but an instance of theActivity
model. So you aren't calling ourActivityLogger::tap()
method but the Laravel Core/Eloquent Model one.laravel-activitylog/src/ActivityLogger.php
Lines 156 to 174 in 0da6f05