Increment value when a button is triggered

Posted 11 months ago by dleroari

So I have two buttons, one is next and the other is prev. My objective is to increment the value everytime the button is clicked.. I guess after this I should just sell groceries or something, maybe I need some sleep, idk!...

Anyway, I would love to know how to do this..

Blade file


    href="/?date=next"
    href="/?date=prev"

Controller file


    public function show(Hour $post){
        if(request()->has('date')){
            if(request('date') == 'next'){
                $this->count++;
                dd($this->count); // This value is not incrementing  
            }
        }
    }

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.