esorone
14
24
Laravel

Save toggle data into db

Posted 1 month ago by esorone

Goodnight,

I'm struggling with saving my toggle data into the database.

I tried numerous options, but no did work

current try. In my view:

                               {{ Form::checkbox('feedbackboolean', 1) }}Ja
                               {{ Form::checkbox('feedbackboolean', 0) }}Nee

Seconds Try: Just a toggle button

<input type="checkbox" name="feedbackboolean" checked data-toggle="toggle" data-on="1" data-off="0">

In my controller:

        $post->feedbackboolean = $request->get('feedbackboolean');

or 

      $post->kennisbankboolean = $request->get('kennisbankboolean', 0);

Or

        $post->feedbackboolean = $request->feedbackboolean;

But unfortunately they did not work. The samples above , are just a sample which I all found online. So somewhere Im misinterpret the solution

The rest of the post form is stored in the database and works as it should be.

What am I missing here.

As always, thanks in advanced.

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.