-
-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow auto parsing the fieldsets
#261
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also add an example to the docs. Make sure it is easily understandable by providing an example URL and what the results would be;
Thanks! |
Of course 🤗 . I'll do it later today or tomorrow 🖖 |
@freekmurze I was going to add some examples to the docs as you requested but while I was at it I noticed that the other semi-related This was my previous attemp at adding those missing docs to |
We have issue after last update to 6.3.0 Error{
"exception": {
"class": "ErrorException",
"message": "Array to string conversion",
"code": 0,
"file": "/var/task/vendor/spatie/fractalistic/src/Fractal.php:277"
},
"aws_request_id": "23a192bf-94de-4a39-a076-518413a24e89"
} Code# Model
class Registration extends Model
{
use HasFactory;
use SoftDeletes;
protected $fillable = [
'organization_id',
'event_id',
'persona_id',
'user_id',
'source',
'barcode',
'fields', // json field
'checks_log', // json
'attendance_log', //json
];
protected $casts = [
'fields' => 'array',
];
}
# Transformer
use App\Models\Registration;
use League\Fractal\TransformerAbstract;
class RegistrationTransformer extends TransformerAbstract
{
/**
* List of resources to automatically include
*/
protected array $defaultIncludes = [
//
];
/**
* List of resources possible to include
*/
protected array $availableIncludes = [
];
/**
* A Fractal transformer.
*/
public function transform(Registration $registration): array
{
return [
'id' => $registration->id,
'organization_id' => $registration->organization_id,
'event_id' => $registration->event_id,
'persona_id' => $registration->persona_id,
'user_id' => $registration->user_id,
'source' => $registration->source,
'barcode' => $registration->barcode,
'fields' => $registration->fields,
'checks_log' => $registration->checks_log,
'attendance_log' => $registration->attendance_log,
];
}
} |
@skrskr could you please create a separate issue for this so we can continue the conversation there? I created a PR to disable |
Hello @Mohammad-Alavi |
Summary
Allow the
fieldsets
to be auto parsed, and configurable similar to the way theinclude
andexclude
features are handled.