1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

laravel 「Add [カラム名] to fillable property to allow mass assignment on [モデル名]」エラーの解決

Last updated at Posted at 2021-11-06

目的

  • Add [カラム名] to fillable property to allow mass assignment on [モデル名]エラーの解決方法をメモ的にまとめる

解決方法

  • エラーに記載されているモデル名のクラスが記載されているファイルを開く。
  • 当該モデルクラス内に下記の内容を記載する。

    protected $fillable = ['エラーで表示されているカラム名'];
    
  • 記入後の例を下記に記載する。

    <?php
    
    namespace App\Models;
    
    use Illuminate\Database\Eloquent\Factories\HasFactory;
    use Illuminate\Database\Eloquent\Model;
    
    class Hoge extends Model
    {
        protected $fillable = ['エラーで表示されているカラム名'];
    }
    
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?