Laravel why record is not updating using vuejs

  laravel, laravel-8, vue.js, vuejs3

i am trying to update text when i send request to Laravel controller, but i am getting error:

500 internal server error 
Uncaught (in promise) Error: Request failed with status code 500

console.log is showing text and values which i am trying to send to controller:

id:16 text:aa

vue js code:

const onEdit=(todo)=>{
    //  var src =
    //  this.txt = src
        .put('', {
        .then(() => getTodos());

    console.log("working", todo.text,;

Laravel COntroller:

public function updateData(Request $request)
    $todo = Todo::find($request->id);

    return response()->json([
        'message' => 'updated'





namespace AppModels;

use IlluminateDatabaseEloquentFactoriesHasFactory;
use IlluminateDatabaseEloquentModel;

class Todo extends Model
    use HasFactory;
    protected $dates = [

    protected $fillable = ['id'];

enter image description here


i checked laravel log and i got error:

Add [id] to fillable property to allow mass assignment on [AppModelsTodo]. 

Then i added id in model. now i am seeing below response in console log but it is not updating data.

enter image description here

Source: Laravel

Leave a Reply