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

Posted 1 year 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.

Reply to

Use Markdown with GitHub-flavored code blocks.