Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ojwando's avatar

Add [user_id] to fillable property to allow mass assignment on [App\Models\Like].

I am getting the above error yet i have fillable property in place.

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Like extends Model
{
    use HasFactory;
    protected $fillabe = ['item_id','user_id'];

    public function user(){
      return  $this->belongsTo(User::class);
    }
    public function item(){
      return  $this->belongsTo(Item::class);
    }
}
0 likes
2 replies
cg0012's avatar
cg0012
Best Answer
Level 4

fillable is spelled wrong

protected $fillabe = ['item_id','user_id'];
1 like

Please or to participate in this conversation.