Add $guarded to UserStatus model to fix bookmarklet mass assignment error#1000
Merged
slime-hatena merged 4 commits intodevelopfrom Nov 3, 2025
Conversation
Co-authored-by: slime-hatena <11350340+slime-hatena@users.noreply.github.com>
Member
|
@copilot 逆にしてほしい Guard id |
Copilot
AI
changed the title
[WIP] ブックマークレット実行時 Add [user_id] to fillable property to allow mass assignment on [App\UserStatus].
Add $fillable to UserStatus model to fix bookmarklet mass assignment error
Nov 3, 2025
Co-authored-by: slime-hatena <11350340+slime-hatena@users.noreply.github.com>
Contributor
Author
Copilot
AI
changed the title
Add $fillable to UserStatus model to fix bookmarklet mass assignment error
Add $guarded to UserStatus model to fix bookmarklet mass assignment error
Nov 3, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds mass assignment protection to the UserStatus model by introducing the $guarded property to protect the id field from being mass-assigned.
- Added
protected $guarded = ['id'];to the UserStatus model to align with Laravel security best practices
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The UserStatus model was missing mass assignment protection, causing
MassAssignmentExceptionwhen the bookmarklet attempted to create user status records.Changes
$guarded = ['id']property toUserStatusmodel to protect only the auto-incrementidfield from mass assignmentuser_id,trophy,level,name,battle_point,rating,rating_max,money,total_money,total_play,comment,friend_code,unique_id,created_at,updated_at) to be mass assignedThis approach is more maintainable than listing all fillable fields and aligns with the project's established pattern.
Original prompt
<issue_description>0.21.2...0.22.0#diff-3532fb886064a45a3c08a87d82e6d3cf52b8a4332fa8967857c8bd7ba971f5a1L11
多分これ
消しちゃダメ 気づかなかった…</issue_description>
Comments on the Issue (you are @copilot in this section)
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.