예제 #1
0
 protected function makeRow($item)
 {
     $row = new Row($item);
     $row->children = array();
     $row->attributes(array('class' => 'datatree-item', 'data-id' => $row->data->getKey()));
     $index = 0;
     foreach ($this->columns as $column) {
         $index++;
         $cell = new Cell($column->name);
         $attrs = array();
         $attrs['data-field-name'] = strpos($column->name, '{{') === false ? $column->name : '_blade_' . $index;
         $cell->attributes($attrs);
         $sanitize = count($column->filters) || $column->cell_callable ? false : true;
         $value = $this->getCellValue($column, $item, $sanitize);
         $cell->value($value);
         $cell->parseFilters($column->filters);
         if ($column->cell_callable) {
             $callable = $column->cell_callable;
             $cell->value($callable($cell->value));
         }
         $row->add($cell);
     }
     if (count($this->row_callable)) {
         foreach ($this->row_callable as $callable) {
             $callable($row);
         }
     }
     return $row;
 }