Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/Generators/stubs/builder.stub
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ class DummyClass extends DataTable
*/
public function dataTable(QueryBuilder $query): EloquentDataTable
{
return datatables()
->eloquent($query)
return (new EloquentDataTable($query))
->addColumn('action', 'DummyAction')
->setRowId('id');
}
Expand Down
11 changes: 6 additions & 5 deletions src/Generators/stubs/datatables.stub
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,20 @@ class DummyClass extends DataTable
->setTableId('DummyTableId')
->columns($this->getColumns())
->minifiedAjax()
->dom('DummyDOM')
//->dom('DummyDOM')
->orderBy(1)
->buttons(
->selectStyleSingle()
->buttons([
DummyButtons
);
]);
}

/**
* Get columns.
* Get the dataTable columns definition.
*
* @return array
*/
protected function getColumns(): array
public function getColumns(): array
{
return [
Column::computed('action')
Expand Down
11 changes: 7 additions & 4 deletions src/Generators/stubs/html.stub
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,20 @@ class DummyClass extends DataTableHtml
return $this->setTableId('DummyTableId')
->columns($this->getColumns())
->minifiedAjax()
->dom('DummyDOM')
//->dom('DummyDOM')
->orderBy(1)
->buttons(
->selectStyleSingle()
->buttons([
DummyButtons
);
]);
}

/**
* Get the dataTable columns definition.
*
* @return array
*/
protected function getColumns(): array
public function getColumns(): array
{
return [
Column::computed('action')
Expand Down
31 changes: 16 additions & 15 deletions src/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/*
* Namespaces used by the generator.
*/
'namespace' => [
'namespace' => [
/*
* Base namespace/directory to create the new file.
* This is appended on default Laravel namespace.
Expand All @@ -13,7 +13,7 @@
* With Model: App\User (default model)
* Export filename: users_timestamp
*/
'base' => 'DataTables',
'base' => 'DataTables',

/*
* Base namespace/directory where your model's are located.
Expand Down Expand Up @@ -42,12 +42,12 @@
/*
* Snappy PDF options.
*/
'snappy' => [
'options' => [
'no-outline' => true,
'margin-left' => '0',
'margin-right' => '0',
'margin-top' => '10mm',
'snappy' => [
'options' => [
'no-outline' => true,
'margin-left' => '0',
'margin-right' => '0',
'margin-top' => '10mm',
'margin-bottom' => '10mm',
],
'orientation' => 'landscape',
Expand All @@ -56,12 +56,13 @@
/*
* Default html builder parameters.
*/
'parameters' => [
'dom' => 'Bfrtip',
'order' => [[0, 'desc']],
'parameters' => [
'dom' => 'Bfrtip',
'order' => [[0, 'desc']],
'buttons' => [
'create',
'export',
'excel',
'csv',
'pdf',
'print',
'reset',
'reload',
Expand All @@ -71,7 +72,7 @@
/*
* Generator command default options value.
*/
'generator' => [
'generator' => [
/*
* Default columns to generate when not set.
*/
Expand All @@ -80,7 +81,7 @@
/*
* Default buttons to generate when not set.
*/
'buttons' => 'create,export,print,reset,reload',
'buttons' => 'excel,csv,pdf,print,reset,reload',

/*
* Default DOM to generate when not set.
Expand Down