|
|
@@ -4,12 +4,13 @@ namespace Dcat\Admin\Grid;
|
|
|
|
|
|
use Closure;
|
|
|
use Dcat\Admin\Grid;
|
|
|
+use Illuminate\Contracts\Support\Arrayable;
|
|
|
use Illuminate\Contracts\Support\Htmlable;
|
|
|
use Illuminate\Contracts\Support\Jsonable;
|
|
|
use Illuminate\Contracts\Support\Renderable;
|
|
|
use Illuminate\Support\Arr;
|
|
|
|
|
|
-class Row
|
|
|
+class Row implements Arrayable
|
|
|
{
|
|
|
/**
|
|
|
* @var Grid
|
|
|
@@ -141,6 +142,18 @@ class Row
|
|
|
return Arr::get($this->data, $attr);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Setter.
|
|
|
+ *
|
|
|
+ * @param mixed $attr
|
|
|
+ * @param mixed $value
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function __set($attr, $value)
|
|
|
+ {
|
|
|
+ Arr::set($this->data, $attr, $value);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Get or set value of column in this row.
|
|
|
*
|
|
|
@@ -166,6 +179,18 @@ class Row
|
|
|
return $this;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function toArray()
|
|
|
+ {
|
|
|
+ if ($this->data instanceof Arrayable) {
|
|
|
+ return $this->data->toArray();
|
|
|
+ }
|
|
|
+
|
|
|
+ return (array) $this->data;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Output column value.
|
|
|
*
|