I have started a project with laravel which has userInfo model. 

As I am trying to insert or update it shows me below error message in Laravel.

Is there any issue with PHP version or with laravel model?



 MassAssignmentException in model.php

Bhaskar Monitor Asked on August 19, 2017 in Programming.
Add Comment
  • 1 Answer(s)

    Error Message:

    
    
    MassAssignmentException in model.php
    
    

    It can occur due to two possibilities:

    • For a mass assignment,  need to provide all the fields of a model which will be mass assigned while during an update or create operation.
      
      
      protected $fillable = ['age', 'phone', 'mail', 'location', 'created_at', 'updated_at'];
      
      
    • Table name should  be assigned in $table = “user_info” in model file
    Bhaskar Monitor Answered on August 19, 2017.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.