| @@ 24-40 (lines=17) @@ | ||
| 21 | return !is_null($this->old($name)); |
|
| 22 | } |
|
| 23 | ||
| 24 | public function oldOrDefault($locale = null) |
|
| 25 | { |
|
| 26 | $name = $this->name(); |
|
| 27 | if ($locale) { |
|
| 28 | $name .= '.'. $locale; |
|
| 29 | } |
|
| 30 | ||
| 31 | if ($this->belongsToArray()) { |
|
| 32 | $name = $this->getDotPatternName(); |
|
| 33 | } |
|
| 34 | ||
| 35 | if ($this->hasOld($name)) { |
|
| 36 | return $this->old($name); |
|
| 37 | } |
|
| 38 | ||
| 39 | return $this->getDefault(); |
|
| 40 | } |
|
| 41 | ||
| 42 | public function oldOrAttribute($model, $locale = null) |
|
| 43 | { |
|
| @@ 42-58 (lines=17) @@ | ||
| 39 | return $this->getDefault(); |
|
| 40 | } |
|
| 41 | ||
| 42 | public function oldOrAttribute($model, $locale = null) |
|
| 43 | { |
|
| 44 | $name = $this->name(); |
|
| 45 | if ($locale) { |
|
| 46 | $name .= '.'. $locale; |
|
| 47 | } |
|
| 48 | ||
| 49 | if ($this->belongsToArray()) { |
|
| 50 | $name = $this->getDotPatternName(); |
|
| 51 | } |
|
| 52 | ||
| 53 | if ($this->hasOld($name)) { |
|
| 54 | return $this->old($name); |
|
| 55 | } |
|
| 56 | ||
| 57 | return $this->getAttribute($model, $locale); |
|
| 58 | } |
|
| 59 | ||
| 60 | public function getAttribute($model, $locale = null) |
|
| 61 | { |
|