Fixed - MassAssignmentException in model.php laravel 5?By Hardik Savani | April 25, 2016 | | 2104 Viewer | Category : Laravel
massassignmentexception is for the security purpose if laravel 5 function. When i did start Laravel 5 and first i did try to add user using "User::create(['name'=>'hd','password'=>'1w'])" then i found bellow error. I was thinking what was wrong, but after investigation i found it for our security purpose, because you have to add field name that you want to insert that way other Http script or hacker etc can't insert something elelse you need to add $fillable variable in your Model. So, let's see user model example.
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
* The attributes that are mass assignable.
* @var array
protected $fillable = [
'name', 'email', 'password','facebook_id'
* The attributes excluded from the model's JSON form.
* @var array
protected $hidden = [
public function dataCreate($input)
- Laravel 5 dropbox api file upload example using league/flysystem-dropbox package
- Laravel 5 - Implementing datatables tutorial using yajra package
- Laravel 5 custom pagination view example
- Solve - no connection could be made target machine actively refused it laravel
- Laravel 5 - How to create custom error page with example
- PHP - How to make dependent dropdown list using jquery Ajax?
- How to uninstall cordova and ionic in ubuntu
- How to create laravel 5 widgets ?