public function show($table) { $rows = DB::table($table)->get(); $html = Table::rows($rows); $columns = DB::select('SHOW COLUMNS FROM ' . $table); foreach ($columns as $column) { if ($pos = strpos($column->Type, '(')) { $column->Type = substr($column->Type, 0, $pos); } if ($column->Type == 'int') { $column->Type = 'integer'; } $html->column($column->Field, $column->Type); } $html = $html->draw($table); return View::make('avalon::import.show', compact('table', 'html')); }
public static function rows($rows) { self::$rows = $rows; return new static(); }
public static function table($object, $fields, $instances) { if (count($instances)) { $table = new Table(); $table->rows($instances); foreach ($fields as $field) { $table->column($field->name, $field->type, $field->title, $field->width, $field->height); } $table->column('updated_at', 'updated_at', trans('avalon::messages.site_updated_at')); if ($object->can_edit) { $table->deletable(); if ($object->order_by == 'precedence') { $table->draggable(URL::action('InstanceController@reorder', $object->name)); } } if (!empty($object->group_by_field)) { $table->groupBy('group'); } return $table->draw(); } }