knuckleswtf / knuckleswtf/scribe

How to deal with custom fields in laravel Resources?

Open
#709 1 comment 0 reactions 0 assignees View on GitHub
question
Dominant language
PHP
Stars
2.3k
Forks
357
PR merge metrics
No merged PRs in 30d

Description

### Scribe version

4

### Your question

I have a resource who returns custom fields that don't exist in the model, so Scribe is giving me this error:

![image](https://github.com/knuckleswtf/scribe/assets/118448356/19588fd5-350d-4051-a3c0-24b24c412048)

Already tried using @mixin in the resource's docblock but it didn't work.

Controller is like this:
![image](https://github.com/knuckleswtf/scribe/assets/118448356/03c2151a-4984-4c66-8e28-2d04b6b83db8)

Can Anybody help me?

### Docs

- [X] I've checked [the docs](https://scribe.knuckles.wtf/laravel), the [troubleshooting guide](https://scribe.knuckles.wtf/laravel/troubleshooting), and [existing issues](https://github.com/knuckleswtf/scribe/issues?q=is%3Aissue+), but I didn't find a solution

Contributor guide

Open the contributing guide

Research direction

Review the Laravel Resource and controller examples shown in the issue, then compare their custom-field behavior with the Scribe Laravel documentation and troubleshooting guide. No source file or test is named; the issue would be resolved when the custom fields are either supported correctly or the required configuration and limitation are documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
laravel, php
Domain
documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.