Skip to content

Commit

Permalink
[9.x] Allow Model::shouldBeStrict(false) to disable "strict mode" (…
Browse files Browse the repository at this point in the history
…#44627)

This is useful when you want to disable "strict" for specific routes.

E.g: packages that needs to have access to accessor and can't comply to
"strict mode"

Signed-off-by: Mior Muhammad Zaki <[email protected]>

Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone authored Oct 18, 2022
1 parent 8436370 commit 3f09fd2
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions Eloquent/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,13 +392,9 @@ public static function isIgnoringTouch($class = null)
*/
public static function shouldBeStrict(bool $shouldBeStrict = true)
{
if (! $shouldBeStrict) {
return;
}

static::preventLazyLoading();
static::preventSilentlyDiscardingAttributes();
static::preventAccessingMissingAttributes();
static::preventLazyLoading($shouldBeStrict);
static::preventSilentlyDiscardingAttributes($shouldBeStrict);
static::preventAccessingMissingAttributes($shouldBeStrict);
}

/**
Expand Down

0 comments on commit 3f09fd2

Please sign in to comment.