From 86b7db48b3913644c9e0c8c0d35960ef1f229fde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Wed, 22 Aug 2018 22:12:23 +0200 Subject: [PATCH] add comments --- app/Models/Row.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/Models/Row.php b/app/Models/Row.php index 2915737..d76a520 100644 --- a/app/Models/Row.php +++ b/app/Models/Row.php @@ -23,12 +23,22 @@ class Row extends BaseModel protected $guarded = []; public $timestamps = false; + /** + * Disable casts, pushing the previous value onto a stack + * + * Needed when using the rowsData() revision method that could + * cause a name collision with a database column, confusing Eloquent + * into applying incorrect casts. + */ public static function disableCasts() { array_push(self::$noCastsStack, self::$noCasts); self::$noCasts = true; } + /** + * Restore the original value of casts enabled/disabled + */ public static function enableCasts() { self::$noCasts = array_pop(self::$noCastsStack);