Skip to content

Commit

Permalink
Rename package to datatables
Browse files Browse the repository at this point in the history
  • Loading branch information
luilliarcec committed May 28, 2024
1 parent d7895e2 commit 4477d1b
Show file tree
Hide file tree
Showing 28 changed files with 61 additions and 60 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"autoload": {
"psr-4": {
"TeamQ\\QueryBuilder\\": "src/"
"TeamQ\\Datatables\\": "src/"
}
},
"autoload-dev": {
Expand All @@ -56,7 +56,7 @@
"extra": {
"laravel": {
"providers": [
"TeamQ\\QueryBuilder\\QueryBuilderServiceProvider"
"TeamQ\\Datatables\\DatatablesServiceProvider"
]
}
},
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/Concerns/HasPropertyRelationship.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace TeamQ\QueryBuilder\Concerns;
namespace TeamQ\Datatables\Concerns;

use Illuminate\Contracts\Database\Query\Expression;
use Illuminate\Database\Eloquent\Builder;
Expand Down
6 changes: 3 additions & 3 deletions src/Concerns/PerPageQuery.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace TeamQ\QueryBuilder\Concerns;
namespace TeamQ\Datatables\Concerns;

use Illuminate\Contracts\Pagination\LengthAwarePaginator;
use Illuminate\Database\Eloquent\Collection;
Expand Down Expand Up @@ -32,7 +32,7 @@ trait PerPageQuery
*/
public function result($perPage = null, array $columns = ['*'], string $pageName = 'page', $page = null): Collection|array|LengthAwarePaginator
{
$paramName = config('query-builder.parameters.per_page', 'per_page');
$paramName = config('datatables.parameters.per_page', 'per_page');

if ($this->isPerPageAll($paramName)) {
return $this->get($columns);
Expand Down Expand Up @@ -108,6 +108,6 @@ protected function isPerPageAll(string $paramName): bool
{
return
$this->maxPerPage === null &&
$this->request->query($paramName) === config('teamq-query-builder.per_page.all');
$this->request->query($paramName) === config('datatables.per_page.all');
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

namespace TeamQ\QueryBuilder;
namespace TeamQ\Datatables;

use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\PackageServiceProvider;

class QueryBuilderServiceProvider extends PackageServiceProvider
class DatatablesServiceProvider extends PackageServiceProvider
{
public function configurePackage(Package $package): void
{
Expand All @@ -15,7 +15,7 @@ public function configurePackage(Package $package): void
* More info: https://github.com/spatie/laravel-package-tools
*/
$package
->name('teamq-query-builder')
->hasConfigFile();
->name('laravel-datatables-api')
->hasConfigFile('datatables');
}
}
2 changes: 1 addition & 1 deletion src/Enums/AggregationType.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace TeamQ\QueryBuilder\Enums;
namespace TeamQ\Datatables\Enums;

/**
* Enum aggregation type.
Expand Down
2 changes: 1 addition & 1 deletion src/Enums/Comparators/Number.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace TeamQ\QueryBuilder\Enums\Comparators;
namespace TeamQ\Datatables\Enums\Comparators;

/**
* Number comparison operators.
Expand Down
2 changes: 1 addition & 1 deletion src/Enums/Comparators/Text.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace TeamQ\QueryBuilder\Enums\Comparators;
namespace TeamQ\Datatables\Enums\Comparators;

/**
* Text comparison operators.
Expand Down
2 changes: 1 addition & 1 deletion src/Enums/JoinType.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace TeamQ\QueryBuilder\Enums;
namespace TeamQ\Datatables\Enums;

/**
* Enum join type.
Expand Down
4 changes: 2 additions & 2 deletions src/Filters/DateFilter.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace TeamQ\QueryBuilder\Filters;
namespace TeamQ\Datatables\Filters;

use TeamQ\QueryBuilder\Enums\Comparators;
use TeamQ\Datatables\Enums\Comparators;

/**
* Adds custom filter support for dates with comparison operators.
Expand Down
6 changes: 3 additions & 3 deletions src/Filters/Filter.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

namespace TeamQ\QueryBuilder\Filters;
namespace TeamQ\Datatables\Filters;

use Illuminate\Database\Eloquent\Builder;
use Spatie\QueryBuilder\Filters\Filter as IFilter;
use TeamQ\QueryBuilder\Concerns\HasPropertyRelationship;
use TeamQ\QueryBuilder\Enums\JoinType;
use TeamQ\Datatables\Concerns\HasPropertyRelationship;
use TeamQ\Datatables\Enums\JoinType;

/**
* Filter Base Class.
Expand Down
6 changes: 3 additions & 3 deletions src/Filters/GlobalFilter.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php

namespace TeamQ\QueryBuilder\Filters;
namespace TeamQ\Datatables\Filters;

use Illuminate\Contracts\Database\Query\Expression;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Collection;
use Spatie\QueryBuilder\AllowedFilter;
use Spatie\QueryBuilder\Filters\Filter;
use TeamQ\QueryBuilder\Concerns\HasPropertyRelationship;
use TeamQ\QueryBuilder\Enums\JoinType;
use TeamQ\Datatables\Concerns\HasPropertyRelationship;
use TeamQ\Datatables\Enums\JoinType;

/**
* Adds global filter support through the `spatie/laravel-query-builder` package.
Expand Down
4 changes: 2 additions & 2 deletions src/Filters/NumberFilter.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace TeamQ\QueryBuilder\Filters;
namespace TeamQ\Datatables\Filters;

use TeamQ\QueryBuilder\Enums\Comparators;
use TeamQ\Datatables\Enums\Comparators;

/**
* Adds custom filter support for numbers with comparison operators.
Expand Down
4 changes: 2 additions & 2 deletions src/Filters/TextFilter.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace TeamQ\QueryBuilder\Filters;
namespace TeamQ\Datatables\Filters;

use TeamQ\QueryBuilder\Enums\Comparators;
use TeamQ\Datatables\Enums\Comparators;

/**
* Adds custom filter support for text with comparison operators.
Expand Down
4 changes: 2 additions & 2 deletions src/QueryBuilder.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace TeamQ\QueryBuilder;
namespace TeamQ\Datatables;

use Spatie\QueryBuilder\QueryBuilder as BaseQueryBuilder;
use TeamQ\QueryBuilder\Concerns\PerPageQuery;
use TeamQ\Datatables\Concerns\PerPageQuery;

/**
* Overwrite the query builder base class and add support for the perPage parameter
Expand Down
8 changes: 4 additions & 4 deletions src/Sorts/CaseSort.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

namespace TeamQ\QueryBuilder\Sorts;
namespace TeamQ\Datatables\Sorts;

use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Query\Expression;
use Spatie\QueryBuilder\Sorts\Sort;
use TeamQ\QueryBuilder\Concerns\HasPropertyRelationship;
use TeamQ\QueryBuilder\Enums\AggregationType;
use TeamQ\QueryBuilder\Enums\JoinType;
use TeamQ\Datatables\Concerns\HasPropertyRelationship;
use TeamQ\Datatables\Enums\AggregationType;
use TeamQ\Datatables\Enums\JoinType;

/**
* Add support for sorting using select case, for cases such as Enums, States, Constants,
Expand Down
8 changes: 4 additions & 4 deletions src/Sorts/RelationSort.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

namespace TeamQ\QueryBuilder\Sorts;
namespace TeamQ\Datatables\Sorts;

use Illuminate\Database\Eloquent\Builder;
use Spatie\QueryBuilder\Sorts\Sort;
use TeamQ\QueryBuilder\Concerns\HasPropertyRelationship;
use TeamQ\QueryBuilder\Enums\AggregationType;
use TeamQ\QueryBuilder\Enums\JoinType;
use TeamQ\Datatables\Concerns\HasPropertyRelationship;
use TeamQ\Datatables\Enums\AggregationType;
use TeamQ\Datatables\Enums\JoinType;

/**
* Adds the possibility to sort by related fields using the kirschbaum-development/eloquent-power-joins.
Expand Down
2 changes: 1 addition & 1 deletion tests/Datasets/Datasets.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use TeamQ\QueryBuilder\Enums\Comparators;
use TeamQ\Datatables\Enums\Comparators;

dataset('per-page-functions', [
'paginate',
Expand Down
6 changes: 3 additions & 3 deletions tests/Filters/DateFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
use Spatie\QueryBuilder\AllowedFilter;
use Spatie\QueryBuilder\QueryBuilder;
use Symfony\Component\HttpFoundation\Request;
use TeamQ\QueryBuilder\Enums\Comparators;
use TeamQ\QueryBuilder\Enums\JoinType;
use TeamQ\QueryBuilder\Filters\DateFilter;
use TeamQ\Datatables\Enums\Comparators;
use TeamQ\Datatables\Enums\JoinType;
use TeamQ\Datatables\Filters\DateFilter;
use Tests\Mocks\Models\Author;
use Tests\Mocks\Models\Book;
use Tests\Mocks\Models\Chapter;
Expand Down
4 changes: 2 additions & 2 deletions tests/Filters/GlobalFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
use Illuminate\Database\Query\Expression;
use Spatie\QueryBuilder\QueryBuilder;
use Symfony\Component\HttpFoundation\Request;
use TeamQ\QueryBuilder\Enums\JoinType;
use TeamQ\QueryBuilder\Filters\GlobalFilter;
use TeamQ\Datatables\Enums\JoinType;
use TeamQ\Datatables\Filters\GlobalFilter;
use Tests\Mocks\Models\Author;
use Tests\Mocks\Models\Book;
use Tests\Mocks\Models\Chapter;
Expand Down
6 changes: 3 additions & 3 deletions tests/Filters/NumberFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
use Spatie\QueryBuilder\AllowedFilter;
use Spatie\QueryBuilder\QueryBuilder;
use Symfony\Component\HttpFoundation\Request;
use TeamQ\QueryBuilder\Enums\Comparators;
use TeamQ\QueryBuilder\Enums\JoinType;
use TeamQ\QueryBuilder\Filters\NumberFilter;
use TeamQ\Datatables\Enums\Comparators;
use TeamQ\Datatables\Enums\JoinType;
use TeamQ\Datatables\Filters\NumberFilter;
use Tests\Mocks\Models\Author;
use Tests\Mocks\Models\Book;
use Tests\Mocks\Models\Chapter;
Expand Down
6 changes: 3 additions & 3 deletions tests/Filters/PowerJoins/TextFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
use Spatie\QueryBuilder\AllowedFilter;
use Spatie\QueryBuilder\QueryBuilder;
use Symfony\Component\HttpFoundation\Request;
use TeamQ\QueryBuilder\Enums\Comparators;
use TeamQ\QueryBuilder\Enums\JoinType;
use TeamQ\QueryBuilder\Filters\TextFilter;
use TeamQ\Datatables\Enums\Comparators;
use TeamQ\Datatables\Enums\JoinType;
use TeamQ\Datatables\Filters\TextFilter;
use Tests\Mocks\Models\Country;
use Tests\Mocks\Models\Flight;

Expand Down
6 changes: 3 additions & 3 deletions tests/Filters/TextFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
use Spatie\QueryBuilder\AllowedFilter;
use Spatie\QueryBuilder\QueryBuilder;
use Symfony\Component\HttpFoundation\Request;
use TeamQ\QueryBuilder\Enums\Comparators;
use TeamQ\QueryBuilder\Enums\JoinType;
use TeamQ\QueryBuilder\Filters\TextFilter;
use TeamQ\Datatables\Enums\Comparators;
use TeamQ\Datatables\Enums\JoinType;
use TeamQ\Datatables\Filters\TextFilter;
use Tests\Mocks\Models\Author;
use Tests\Mocks\Models\Book;
use Tests\Mocks\Models\Chapter;
Expand Down
2 changes: 1 addition & 1 deletion tests/Queries/PerPageQueryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;
use Symfony\Component\HttpFoundation\Request;
use TeamQ\QueryBuilder\QueryBuilder;
use TeamQ\Datatables\QueryBuilder;
use Tests\Mocks\Models\Author;

beforeEach(function () {
Expand Down
2 changes: 1 addition & 1 deletion tests/Sorts/CaseSortTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use Spatie\QueryBuilder\AllowedSort;
use Spatie\QueryBuilder\QueryBuilder;
use Symfony\Component\HttpFoundation\Request;
use TeamQ\QueryBuilder\Sorts\CaseSort;
use TeamQ\Datatables\Sorts\CaseSort;
use Tests\Mocks\Enums\AuthorTypeEnum;
use Tests\Mocks\Enums\BookClassificationEnum;
use Tests\Mocks\Models\Author;
Expand Down
4 changes: 2 additions & 2 deletions tests/Sorts/PowerJoins/RelationSortTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
use Spatie\QueryBuilder\AllowedSort;
use Spatie\QueryBuilder\QueryBuilder;
use Symfony\Component\HttpFoundation\Request;
use TeamQ\QueryBuilder\Enums\JoinType;
use TeamQ\QueryBuilder\Sorts\RelationSort;
use TeamQ\Datatables\Enums\JoinType;
use TeamQ\Datatables\Sorts\RelationSort;
use Tests\Mocks\Models\Country;
use Tests\Mocks\Models\Flight;

Expand Down
6 changes: 3 additions & 3 deletions tests/Sorts/RelationSortTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
use Spatie\QueryBuilder\AllowedSort;
use Spatie\QueryBuilder\QueryBuilder;
use Symfony\Component\HttpFoundation\Request;
use TeamQ\QueryBuilder\Enums\AggregationType;
use TeamQ\QueryBuilder\Enums\JoinType;
use TeamQ\QueryBuilder\Sorts\RelationSort;
use TeamQ\Datatables\Enums\AggregationType;
use TeamQ\Datatables\Enums\JoinType;
use TeamQ\Datatables\Sorts\RelationSort;
use Tests\Mocks\Enums\BookClassificationEnum;
use Tests\Mocks\Models\Author;
use Tests\Mocks\Models\Book;
Expand Down
5 changes: 3 additions & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

use Kirschbaum\PowerJoins\PowerJoinsServiceProvider;
use Orchestra\Testbench\TestCase as Orchestra;
use TeamQ\QueryBuilder\QueryBuilderServiceProvider;
use Spatie\QueryBuilder\QueryBuilderServiceProvider;
use TeamQ\Datatables\DatatablesServiceProvider;

class TestCase extends Orchestra
{
Expand All @@ -18,8 +19,8 @@ protected function setUp(): void
protected function getPackageProviders($app): array
{
return [
\Spatie\QueryBuilder\QueryBuilderServiceProvider::class,
QueryBuilderServiceProvider::class,
DatatablesServiceProvider::class,
PowerJoinsServiceProvider::class,
];
}
Expand Down

0 comments on commit 4477d1b

Please sign in to comment.