File tree 2 files changed +13
-0
lines changed
src/Illuminate/Database/Eloquent/Concerns
tests/Integration/Database
2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -163,6 +163,10 @@ public function isFillable($key)
163
163
*/
164
164
public function isGuarded ($ key )
165
165
{
166
+ if (strpos ($ key , '-> ' )) {
167
+ $ key = Str::before ($ key , '-> ' );
168
+ }
169
+
166
170
return $ this ->getGuarded () == ['* ' ] || ! empty (preg_grep ('/^ ' .preg_quote ($ key ).'$/i ' , $ this ->getGuarded ()));
167
171
}
168
172
Original file line number Diff line number Diff line change @@ -38,6 +38,15 @@ public function testCantUpdateGuardedAttributesUsingDifferentCasing()
38
38
$ this ->assertNull ($ model ->ID );
39
39
}
40
40
41
+ public function testCantUpdateGuardedAttributeUsingJson ()
42
+ {
43
+ $ model = new TestModel2 ;
44
+
45
+ $ model ->fill (['id->foo ' => 123 ]);
46
+
47
+ $ this ->assertNull ($ model ->id );
48
+ }
49
+
41
50
public function testUserCanUpdateNullableDate ()
42
51
{
43
52
$ user = TestModel1::create ([
You can’t perform that action at this time.
0 commit comments