Skip to content

Commit e66de39

Browse files
committed
- Updated Api controller stub to query builder v3
1 parent 379153b commit e66de39

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

stubs/Controllers/ModelApiController.stub

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class {{pluralStudly}}Controller extends ApiController
1414
*
1515
* @return Builder
1616
*/
17-
protected function getBaseQuery(): Builder
17+
public function getBaseQuery(): Builder
1818
{
1919
return {{singularStudly}}::query();
2020
}
@@ -24,7 +24,7 @@ class {{pluralStudly}}Controller extends ApiController
2424
*
2525
* @return array
2626
*/
27-
protected function getAllowedFields(): array
27+
public function getAllowedFields(): array
2828
{
2929
return array_diff(\Schema::getColumnListing('{{tableName}}'), (new {{singularStudly}})->getHidden());
3030
}
@@ -34,7 +34,7 @@ class {{pluralStudly}}Controller extends ApiController
3434
*
3535
* @return array
3636
*/
37-
protected function getAllowedIncludes(): array
37+
public function getAllowedIncludes(): array
3838
{
3939
return [
4040
// allowed includes
@@ -46,7 +46,7 @@ class {{pluralStudly}}Controller extends ApiController
4646
*
4747
* @return array
4848
*/
49-
protected function getAllowedAppends(): array
49+
public function getAllowedAppends(): array
5050
{
5151
return [
5252
];
@@ -57,7 +57,7 @@ class {{pluralStudly}}Controller extends ApiController
5757
*
5858
* @return array
5959
*/
60-
protected function getAllowedSorts(): array
60+
public function getAllowedSorts(): array
6161
{
6262
return [
6363
// allowed sorts
@@ -69,7 +69,7 @@ class {{pluralStudly}}Controller extends ApiController
6969
*
7070
* @return string
7171
*/
72-
protected function getDefaultSort(): string
72+
public function getDefaultSort(): string
7373
{
7474
return '{{defaultSort}}';
7575
}
@@ -79,7 +79,7 @@ class {{pluralStudly}}Controller extends ApiController
7979
*
8080
* @return array
8181
*/
82-
protected function getAllowedFilters(): array
82+
public function getAllowedFilters(): array
8383
{
8484
return [
8585
// allowed filters

tests/stubs/Controllers/Api/CategoriesController.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class CategoriesController extends ApiController
1414
*
1515
* @return Builder
1616
*/
17-
protected function getBaseQuery(): Builder
17+
public function getBaseQuery(): Builder
1818
{
1919
return Category::query();
2020
}
@@ -24,7 +24,7 @@ protected function getBaseQuery(): Builder
2424
*
2525
* @return array
2626
*/
27-
protected function getAllowedFields(): array
27+
public function getAllowedFields(): array
2828
{
2929
return array_diff(\Schema::getColumnListing('categories'), (new Category)->getHidden());
3030
}
@@ -34,7 +34,7 @@ protected function getAllowedFields(): array
3434
*
3535
* @return array
3636
*/
37-
protected function getAllowedIncludes(): array
37+
public function getAllowedIncludes(): array
3838
{
3939
return [
4040
];
@@ -45,7 +45,7 @@ protected function getAllowedIncludes(): array
4545
*
4646
* @return array
4747
*/
48-
protected function getAllowedAppends(): array
48+
public function getAllowedAppends(): array
4949
{
5050
return [
5151
];
@@ -56,7 +56,7 @@ protected function getAllowedAppends(): array
5656
*
5757
* @return array
5858
*/
59-
protected function getAllowedSorts(): array
59+
public function getAllowedSorts(): array
6060
{
6161
return [
6262
'id',
@@ -72,7 +72,7 @@ protected function getAllowedSorts(): array
7272
*
7373
* @return string
7474
*/
75-
protected function getDefaultSort(): string
75+
public function getDefaultSort(): string
7676
{
7777
return 'created_at';
7878
}
@@ -82,7 +82,7 @@ protected function getDefaultSort(): string
8282
*
8383
* @return array
8484
*/
85-
protected function getAllowedFilters(): array
85+
public function getAllowedFilters(): array
8686
{
8787
return [
8888
'id',

tests/stubs/Controllers/Api/ProductsController.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class ProductsController extends ApiController
1414
*
1515
* @return Builder
1616
*/
17-
protected function getBaseQuery(): Builder
17+
public function getBaseQuery(): Builder
1818
{
1919
return Product::query();
2020
}
@@ -24,7 +24,7 @@ protected function getBaseQuery(): Builder
2424
*
2525
* @return array
2626
*/
27-
protected function getAllowedFields(): array
27+
public function getAllowedFields(): array
2828
{
2929
return array_diff(\Schema::getColumnListing('products'), (new Product)->getHidden());
3030
}
@@ -34,7 +34,7 @@ protected function getAllowedFields(): array
3434
*
3535
* @return array
3636
*/
37-
protected function getAllowedIncludes(): array
37+
public function getAllowedIncludes(): array
3838
{
3939
return [
4040
'category',
@@ -46,7 +46,7 @@ protected function getAllowedIncludes(): array
4646
*
4747
* @return array
4848
*/
49-
protected function getAllowedAppends(): array
49+
public function getAllowedAppends(): array
5050
{
5151
return [
5252
];
@@ -57,7 +57,7 @@ protected function getAllowedAppends(): array
5757
*
5858
* @return array
5959
*/
60-
protected function getAllowedSorts(): array
60+
public function getAllowedSorts(): array
6161
{
6262
return [
6363
'id',
@@ -81,7 +81,7 @@ protected function getAllowedSorts(): array
8181
*
8282
* @return string
8383
*/
84-
protected function getDefaultSort(): string
84+
public function getDefaultSort(): string
8585
{
8686
return 'created_at';
8787
}
@@ -91,7 +91,7 @@ protected function getDefaultSort(): string
9191
*
9292
* @return array
9393
*/
94-
protected function getAllowedFilters(): array
94+
public function getAllowedFilters(): array
9595
{
9696
return [
9797
'id',

0 commit comments

Comments
 (0)