Skip to content

Commit d0774dd

Browse files
authored
Merge pull request #161 from yajra/stubs
chore: update stubs to the latest coding style
2 parents 6df0a0d + df85d92 commit d0774dd

File tree

4 files changed

+30
-26
lines changed

4 files changed

+30
-26
lines changed

src/Generators/stubs/builder.stub

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ class DummyClass extends DataTable
1818
*/
1919
public function dataTable(QueryBuilder $query): EloquentDataTable
2020
{
21-
return datatables()
22-
->eloquent($query)
21+
return (new EloquentDataTable($query))
2322
->addColumn('action', 'DummyAction')
2423
->setRowId('id');
2524
}

src/Generators/stubs/datatables.stub

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,20 @@ class DummyClass extends DataTable
4949
->setTableId('DummyTableId')
5050
->columns($this->getColumns())
5151
->minifiedAjax()
52-
->dom('DummyDOM')
52+
//->dom('DummyDOM')
5353
->orderBy(1)
54-
->buttons(
54+
->selectStyleSingle()
55+
->buttons([
5556
DummyButtons
56-
);
57+
]);
5758
}
5859

5960
/**
60-
* Get columns.
61+
* Get the dataTable columns definition.
6162
*
6263
* @return array
6364
*/
64-
protected function getColumns(): array
65+
public function getColumns(): array
6566
{
6667
return [
6768
Column::computed('action')

src/Generators/stubs/html.stub

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,20 @@ class DummyClass extends DataTableHtml
2121
return $this->setTableId('DummyTableId')
2222
->columns($this->getColumns())
2323
->minifiedAjax()
24-
->dom('DummyDOM')
24+
//->dom('DummyDOM')
2525
->orderBy(1)
26-
->buttons(
26+
->selectStyleSingle()
27+
->buttons([
2728
DummyButtons
28-
);
29+
]);
2930
}
3031

3132
/**
33+
* Get the dataTable columns definition.
34+
*
3235
* @return array
3336
*/
34-
protected function getColumns(): array
37+
public function getColumns(): array
3538
{
3639
return [
3740
Column::computed('action')

src/config/config.php

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/*
55
* Namespaces used by the generator.
66
*/
7-
'namespace' => [
7+
'namespace' => [
88
/*
99
* Base namespace/directory to create the new file.
1010
* This is appended on default Laravel namespace.
@@ -13,7 +13,7 @@
1313
* With Model: App\User (default model)
1414
* Export filename: users_timestamp
1515
*/
16-
'base' => 'DataTables',
16+
'base' => 'DataTables',
1717

1818
/*
1919
* Base namespace/directory where your model's are located.
@@ -42,12 +42,12 @@
4242
/*
4343
* Snappy PDF options.
4444
*/
45-
'snappy' => [
46-
'options' => [
47-
'no-outline' => true,
48-
'margin-left' => '0',
49-
'margin-right' => '0',
50-
'margin-top' => '10mm',
45+
'snappy' => [
46+
'options' => [
47+
'no-outline' => true,
48+
'margin-left' => '0',
49+
'margin-right' => '0',
50+
'margin-top' => '10mm',
5151
'margin-bottom' => '10mm',
5252
],
5353
'orientation' => 'landscape',
@@ -56,12 +56,13 @@
5656
/*
5757
* Default html builder parameters.
5858
*/
59-
'parameters' => [
60-
'dom' => 'Bfrtip',
61-
'order' => [[0, 'desc']],
59+
'parameters' => [
60+
'dom' => 'Bfrtip',
61+
'order' => [[0, 'desc']],
6262
'buttons' => [
63-
'create',
64-
'export',
63+
'excel',
64+
'csv',
65+
'pdf',
6566
'print',
6667
'reset',
6768
'reload',
@@ -71,7 +72,7 @@
7172
/*
7273
* Generator command default options value.
7374
*/
74-
'generator' => [
75+
'generator' => [
7576
/*
7677
* Default columns to generate when not set.
7778
*/
@@ -80,7 +81,7 @@
8081
/*
8182
* Default buttons to generate when not set.
8283
*/
83-
'buttons' => 'create,export,print,reset,reload',
84+
'buttons' => 'excel,csv,pdf,print,reset,reload',
8485

8586
/*
8687
* Default DOM to generate when not set.

0 commit comments

Comments
 (0)