Can $collection->increment('field') fail?

Posted 7 months ago by eddieace

I have a redirect function that looks like this. For some reason, it looks like it's sometimes missing to increment the item. I'm wondering if it sometimes can be so that it misses this because some caching or something?

public function redirect($key)
{
    $item = $this->item->findOrFail($key);

    $item->increment('redirects');

    $encode = urlencode($item->_url);

    return view('item.redirect', ['url' => ($encode)]);
}

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.