-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5c84134
commit d9b3d0d
Showing
9 changed files
with
156 additions
and
42 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,31 @@ | ||
<?php | ||
|
||
namespace Lomkit\Rest\Http\Requests; | ||
|
||
use Closure; | ||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests; | ||
use Illuminate\Support\Arr; | ||
use Illuminate\Support\Fluent; | ||
use Illuminate\Support\Str; | ||
use Illuminate\Validation\Rule; | ||
use Lomkit\Rest\Actions\Action; | ||
use Lomkit\Rest\Contracts\QueryBuilder; | ||
use Lomkit\Rest\Http\Controllers\Controller; | ||
use Lomkit\Rest\Http\Resource; | ||
use Lomkit\Rest\Relations\BelongsTo; | ||
use Lomkit\Rest\Relations\BelongsToMany; | ||
use Lomkit\Rest\Relations\HasMany; | ||
use Lomkit\Rest\Relations\HasManyThrough; | ||
use Lomkit\Rest\Relations\MorphedByMany; | ||
use Lomkit\Rest\Relations\MorphMany; | ||
use Lomkit\Rest\Relations\MorphToMany; | ||
use Lomkit\Rest\Rules\ActionField; | ||
use Lomkit\Rest\Rules\CustomRulable; | ||
use Lomkit\Rest\Rules\Includable; | ||
use Lomkit\Rest\Rules\RequiredRelation; | ||
use Symfony\Component\HttpKernel\Exception\HttpException; | ||
|
||
class DetailRequest extends RestRequest | ||
{ | ||
|
||
} |
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
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,45 @@ | ||
<?php | ||
|
||
namespace Lomkit\Rest\Tests\Feature\Controllers; | ||
|
||
use Illuminate\Bus\PendingBatch; | ||
use Illuminate\Queue\Queue; | ||
use Illuminate\Support\Facades\Bus; | ||
use Illuminate\Support\Facades\Gate; | ||
use Lomkit\Rest\Actions\CallRestApiAction; | ||
use Lomkit\Rest\Http\Requests\RestRequest; | ||
use Lomkit\Rest\Tests\Feature\TestCase; | ||
use Lomkit\Rest\Tests\Support\Database\Factories\BelongsToManyRelationFactory; | ||
use Lomkit\Rest\Tests\Support\Database\Factories\BelongsToRelationFactory; | ||
use Lomkit\Rest\Tests\Support\Database\Factories\HasManyRelationFactory; | ||
use Lomkit\Rest\Tests\Support\Database\Factories\HasOneRelationFactory; | ||
use Lomkit\Rest\Tests\Support\Database\Factories\ModelFactory; | ||
use Lomkit\Rest\Tests\Support\Models\BelongsToManyRelation; | ||
use Lomkit\Rest\Tests\Support\Models\BelongsToRelation; | ||
use Lomkit\Rest\Tests\Support\Models\Model; | ||
use Lomkit\Rest\Tests\Support\Policies\GreenPolicy; | ||
use Lomkit\Rest\Tests\Support\Policies\RedPolicy; | ||
use Lomkit\Rest\Tests\Support\Rest\Resources\BelongsToManyResource; | ||
use Lomkit\Rest\Tests\Support\Rest\Resources\BelongsToResource; | ||
use Lomkit\Rest\Tests\Support\Rest\Resources\HasManyResource; | ||
use Lomkit\Rest\Tests\Support\Rest\Resources\HasOneResource; | ||
use Lomkit\Rest\Tests\Support\Rest\Resources\ModelResource; | ||
|
||
class DetailOperationsTest extends TestCase | ||
{ | ||
public function test_operate_action(): void | ||
{ | ||
ModelFactory::new()->count(2)->create(); | ||
|
||
Gate::policy(Model::class, GreenPolicy::class); | ||
|
||
$response = $this->get( | ||
'/api/models', | ||
['Accept' => 'application/json'] | ||
); | ||
|
||
$response->assertJson([ | ||
'data' => (new ModelResource())->jsonSerialize() | ||
]); | ||
} | ||
} |