Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 260dc0a

Browse files
committed
dont allow mass filling with table names
1 parent 56e6134 commit 260dc0a

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

Eloquent/Concerns/GuardsAttributes.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ public function isFillable($key)
152152
}
153153

154154
return empty($this->getFillable()) &&
155+
strpos($key, '.') === false &&
155156
! Str::startsWith($key, '_');
156157
}
157158

Eloquent/Model.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -376,15 +376,6 @@ public function qualifyColumn($column)
376376
*/
377377
protected function removeTableFromKey($key)
378378
{
379-
if (strpos($key, '.') !== false) {
380-
if (! empty($this->getGuarded()) &&
381-
$this->getGuarded() !== ['*']) {
382-
throw new LogicException('Mass assignment of Eloquent attributes including table names is unsafe when guarding attributes.');
383-
}
384-
385-
return last(explode('.', $key));
386-
}
387-
388379
return $key;
389380
}
390381

0 commit comments

Comments
 (0)