Posted inTechnology / Ajax / JavaScript / jQuery / Laravel

Laravel 5.7 Toggle switch Update DB field using Ajax

Today, We want to share with you Laravel 5.7 Toggle switch Update DB field using Ajax.In this post we will show you Bootstrap Toggle Switch Inside Laravel Examples, hear for Use Ajax Checkbox Toggles To Update The Database we will give you demo and example for implement.In this post, we will learn about Bootstrap Toggle switch Update DB field using Ajax with Laravel 5.7 with an example.

Laravel 5.7 Toggle switch Update DB field using Ajax

There are the Following The simple About Laravel 5.7 Toggle switch Update DB field using Ajax Full Information With Example and source code.

As I will cover this Post with live Working example to develop php Laravel toggle switch with ajax update, so the Simple Laravel Toggle Switch Plugin With jQuery And Bootstrap for this example is following below.Demo – Laravel 5.7 toggle switch

Step 1: Laravel Create a Controller

Laravel – Toggle value in database with checkbox and ajax Example

public function updateProductStatus(Request $request)

    $member = User::findOrFail($request->member_id);
    if($member->active == 1){
        $member->active = 0;
    } else {
        $member->active = 1;
    return response()->json([
      'data' => [
        'success' => $member->save(),

Step 2: JavaScript Source Code

  $("input:checkbox").change(function() {
    var member_id = $(this).closest('tr').attr('id');

            headers: {'X-CSRF-TOKEN': '{{ csrf_token() }}' },
            data: { "member_id" : member_id },
            success: function(data){
                //do something logic

Related Keywords: laravel toggle button, Laravel 5.7 toggle switch, Laravel 5.7 toggle switch with text, Laravel 5.7 toggle switch, html toggle button, ajax toggle button php, Laravel 5.7 switch options, Laravel 5.7 toggle set value

Angular 6 CRUD Operations Application Tutorials

Read :


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Laravel 5.7 Toggle switch Update DB field using Ajax.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

Your email address will not be published. Required fields are marked *

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype