Skip to content

Commit ffb816c

Browse files
committed
fix: wip
1 parent 003bbb3 commit ffb816c

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

src/Eager/Related.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@ public function resolveField(Repository $repository): EagerField
7171

7272
public function resolve(RestifyRequest $request, Repository $repository): self
7373
{
74-
ray($repository->request instanceof MCPRequest, $repository::uriKey())->green();
75-
76-
ray($repository->request instanceof McpRequest);
77-
7874
$request->related()->resolved($this->uniqueIdentifierForRepository($repository));
7975

8076
if (is_callable($this->resolverCallback)) {

src/Fields/EagerField.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Binaryk\LaravelRestify\Fields;
44

55
use Binaryk\LaravelRestify\Filters\RelatedQuery;
6+
use Binaryk\LaravelRestify\MCP\Requests\McpRequest;
67
use Binaryk\LaravelRestify\Repositories\Repository;
78
use Binaryk\LaravelRestify\Restify;
89
use Binaryk\LaravelRestify\Traits\HasColumns;
@@ -82,10 +83,14 @@ public function resolve($repository, $attribute = null)
8283
*/
8384
$serializableRepository = $this->repositoryClass::resolveWith($relatedModel);
8485

85-
$serializableRepository->request = $repository->request;
86+
// Only set the request for MCP requests to preserve MCP-specific behavior
87+
// without interfering with regular column selection
88+
if (isset($repository->request) && $repository->request instanceof McpRequest) {
89+
$serializableRepository->request = $repository->request;
90+
}
8691

8792
$this->value = $serializableRepository
88-
->allowToShow(app(Request::class))
93+
->allowToShow($repository->request ?? app(Request::class))
8994
->columns()
9095
->eager($this);
9196
} catch (AuthorizationException) {

src/MCP/Prompts/.gitkeep

Whitespace-only changes.

tests/Fields/BelongsToFieldTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ public function test_belongs_to_could_choose_columns(): void
223223
$this->withoutExceptionHandling();
224224

225225
$this->getJson(PostRepository::route($post, query: [
226-
'include' => 'user[name]',
226+
'include' => 'user[name,email]',
227227
]))
228228
->assertJson(
229229
fn (AssertableJson $json) => $json

0 commit comments

Comments
 (0)