-
activity()
->causedBy($userModel)
->tap(function(Activity $activity) {
$activity->my_custom_field = 'my special value';
})
->log(); How to add a variable instead of 'my special value' ? |
Beta Was this translation helpful? Give feedback.
Answered by
Gummibeer
Dec 8, 2020
Replies: 2 comments
-
Hey, $var = 'my special value';
activity()
->causedBy($userModel)
->tap(function(Activity $activity) use ($var) {
$activity->my_custom_field = $var;
})
->log(); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
prodv
-
Wow nice!!
…On Tue, Dec 8, 2020 at 11:24 PM Tom Witkowski ***@***.***> wrote:
Hey,
that's basic PHP you can use a variable in the function declaration.
$var = 'my special value';
activity()
->causedBy($userModel)
->tap(function(Activity $activity) use ($var) {
$activity->my_custom_field = $var;
})
->log();
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#819 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACIU4KC5ZAPRB75BQ6MYKCTSTZR67ANCNFSM4USE62KQ>
.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey,
that's basic PHP you can
use
a variable in the function declaration.