-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable
QueryBuilder
to be resolved from the container
- Loading branch information
Showing
9 changed files
with
169 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace Rareloop\Lumberjack\QueryBuilder\Contracts; | ||
|
||
use Tightenco\Collect\Support\Collection; | ||
|
||
interface QueryBuilder | ||
{ | ||
public function getParameters() : array; | ||
|
||
public function wherePostType($postType) : QueryBuilder; | ||
|
||
public function limit($limit) : QueryBuilder; | ||
|
||
public function offset($offset) : QueryBuilder; | ||
|
||
public function orderBy($orderBy, string $order = QueryBuilder::ASC) : QueryBuilder; | ||
|
||
public function orderByMeta($metaKey, string $order = QueryBuilder::ASC, string $type = null) : QueryBuilder; | ||
|
||
public function whereIdIn(array $ids) : QueryBuilder; | ||
|
||
public function whereIdNotIn(array $ids) : QueryBuilder; | ||
|
||
public function whereStatus() : QueryBuilder; | ||
|
||
public function whereMeta($key, $value, $compare = '=', $type = null) : QueryBuilder; | ||
|
||
public function whereMetaRelationshipIs(string $relation) : QueryBuilder; | ||
|
||
public function get() : Collection; | ||
|
||
public function clone() : QueryBuilder; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace Rareloop\Lumberjack\QueryBuilder; | ||
|
||
use Rareloop\Lumberjack\Providers\ServiceProvider; | ||
use Rareloop\Lumberjack\QueryBuilder\Contracts\QueryBuilder as QueryBuilderContract; | ||
use Rareloop\Lumberjack\QueryBuilder\QueryBuilder; | ||
|
||
class QueryBuilderServiceProvider extends ServiceProvider | ||
{ | ||
public function register() | ||
{ | ||
$this->app->bind(QueryBuilderContract::class, QueryBuilder::class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Rareloop\Lumberjack\QueryBuilder\Test\Providers; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Rareloop\Lumberjack\Application; | ||
use Rareloop\Lumberjack\Config; | ||
use Rareloop\Lumberjack\Http\Lumberjack; | ||
use Rareloop\Lumberjack\QueryBuilder\Contracts\QueryBuilder as QueryBuilderContract; | ||
use Rareloop\Lumberjack\QueryBuilder\QueryBuilderServiceProvider; | ||
|
||
class PostQueryBuilderTest extends TestCase | ||
{ | ||
/** @test */ | ||
public function query_builder_is_registered_into_container() | ||
{ | ||
$app = new Application; | ||
$provider = new QueryBuilderServiceProvider($app); | ||
|
||
$provider->register(); | ||
|
||
$this->assertTrue($app->has(QueryBuilderContract::class)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters