add comments

master
Ondřej Hruška 6 years ago
parent 6c2d19b55c
commit 86b7db48b3
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 10
      app/Models/Row.php

@ -23,12 +23,22 @@ class Row extends BaseModel
protected $guarded = []; protected $guarded = [];
public $timestamps = false; 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() public static function disableCasts()
{ {
array_push(self::$noCastsStack, self::$noCasts); array_push(self::$noCastsStack, self::$noCasts);
self::$noCasts = true; self::$noCasts = true;
} }
/**
* Restore the original value of casts enabled/disabled
*/
public static function enableCasts() public static function enableCasts()
{ {
self::$noCasts = array_pop(self::$noCastsStack); self::$noCasts = array_pop(self::$noCastsStack);

Loading…
Cancel
Save