Tap, Tap, Tap
Taylor Otwell

I never used this helper before, and I do not see why I should use this. Can someone explain why:

return tap($this->newModelInstance($attributes), function ($instance) { $instance->save(); });

is better than:

return $this->newModelInstance($attributes)->save();

Because if the reason is to return the value, which we definitely will use and definitely will also create variable for it, why not just use it normally?

$model = new Model($attr); $model->save();

In case if the class is not fluent, I do not see why we need to tap into it because in the end we will still store the tapped value into variables anyway.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.