Skip to content

Commit

Permalink
Do not store guarded attributes
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Poyigi <[email protected]>
  • Loading branch information
sampoyigi committed Oct 21, 2022
1 parent 49fa856 commit 0d57ad6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
3 changes: 3 additions & 0 deletions classes/AbstractRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@ protected function setModelAttributes($model, $saveData)

$singularTypes = ['belongsTo', 'hasOne', 'morphOne'];
foreach ($saveData as $attribute => $value) {
if ($model->isGuarded($attribute))
continue;

$isNested = ($attribute == 'pivot' || (
$model->hasRelation($attribute) &&
in_array($model->getRelationType($attribute), $singularTypes)
Expand Down
7 changes: 0 additions & 7 deletions classes/ApiManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,4 @@ protected function parseName($name)
{
return studly_case(preg_replace('/[0-9]+/', '', $name));
}

protected function getClassPath($class)
{
$path = trim(str_replace('\\', '/', $class), '/');

return extension_path(strtolower(dirname($path)).'/'.basename($path).'.php');
}
}

0 comments on commit 0d57ad6

Please sign in to comment.