/** * {@inheritDoc} */ public function truncateTableSql(Table $table) { $name = $this->_driver->quoteIdentifier($table->name()); $queries = [sprintf('DELETE FROM %s', $name)]; // Restart identity sequences $pk = $table->primaryKey(); if (count($pk) === 1) { $column = $table->column($pk[0]); if (in_array($column['type'], ['integer', 'biginteger'])) { $queries[] = sprintf('DBCC CHECKIDENT(%s, RESEED, 0)', $name); } } return $queries; }
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(); } }