Today, We want to share with you laravel 6 Update Data in AJAX CRUD.In this post we will show you Update data from database using Laravel and Ajax, hear for Update data from database using Laravel framework we will give you demo and example for implement.In this post, we will learn about CRUD (Create Read Update Delete) in a Laravel 6 App with an example.
laravel 6 Update Data in AJAX CRUD
There are the Following The simple About Insert Update and Delete record from MySQL in Laravel 6 Full Information With Example and source code.
As I will cover this Post with live Working example to develop update data in laravel using model, so the update record in laravel using eloquent is used for this example is following below.
Step 1: Define a Laravel Route
web.php (route)
Route::resource('/memberInformation','MemberInfoController');
Step 2: Make a controller in Laravel
memberInformationConstroller.php (controller)
public function edit($id) { $memberInformation = MemberInfo::find($id); return view('memberInformation.edit',compact('memberInformation','id')); } public function update($id) { $memberInformation = MemberInfo::find($id); $memberInformation->type = request('type'); $memberInformation->name = request('name'); $memberInformation->email = request('email'); $memberInformation->mobile = request('mobile'); $memberInformation->address = request('address'); $memberInformation->save(); return json_encode(array('statusCode'=>200)); }
Step 3: Create a laravel Model
memberInformation.php (Model)
class MemberInfo extends Model { protected $table = 'members_details'; protected $fillable = [ 'type','name', 'email','mobile','address' ]; }
Step 4: Blade Edit View File
edit.blade.php
@extends('memberInformation.layout') @section('content')--}} @endsection@if ($errors->any())Edit Member
Whoops! There were some problems with your input.@endif {{--
@foreach ($errors->all() as $error)
- {{ $error }}
@endforeach
Step 5: Layout File
layout.blade.php
PHP Laravel 6 CRUD using jQuery Ajax @yield('content')
Web Programming Tutorials Example with Demo
Read :
Summary
You can also read about AngularJS, ASP.NET, VueJs, PHP.
I hope you get an idea about laravel 6 Update data using jQuery Ajax.
I would like to have feedback on my infinityknow.com 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.