简体   繁体   English

将 [username] 添加到可填充属性以允许在 [App/post] 上进行批量分配

[英]Add [username] to fillable property to allow mass assignment on [App/post]

Iam learning Laravel and PHP, I am trying to add a post into my table by using Tinker from Artisan.我正在学习 Laravel 和 PHP,我正在尝试使用 Artisan 的 Tinker 将帖子添加到我的表中。

I receive these error I don't understand :我收到这些我不明白的错误:

Illuminate/Database/Eloquent/MassAssignmentException with message 'Add [username] to fillable property to allow mass assignment on [App/post].'

In my Post.php model I have :在我的 Post.php 模型中,我有:

    protected $fillable = ['username', 'email', 'content'];

Thank you for your help感谢您的帮助

尝试退出 tinker 并再次运行php artisan tiker ,tinker 在运行时不会跟踪更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM