Mapping a request onto a data object is not working #46
Replies: 4 comments 3 replies
-
Could you give us a bit more information about what's going wrong exactly? |
Beta Was this translation helpful? Give feedback.
-
it gives syntax error on " { " in the line {$request->input('title_of_song')},
then how should i map the coming request , as my database fields with this request with my Data Files ,as my database contains two tables fields mainly i have tried using nested example i have 3 Data files ,ie. MainData, AuthorInfoData, AlbumInfoData MainData
and inside AuthorInfoData
it gives syntax error on {$request->input('authorInfo.authorName')}, and then i manage to change the way of writing the above function like this
But still it doesnot work Can u please throw some light on this ? how to manage and map request coming from front end on above scenario |
Beta Was this translation helpful? Give feedback.
-
That's because this syntax isn't valid: public static function fromRequest(Request $request): static
{
return new self(
{$request->input('title_of_song')},
{$request->input('artist_name')}
);
} You should do the following: public static function fromRequest(Request $request): static
{
return new self(
$request->input('title_of_song'),
$request->input('artist_name')
);
} I've updated the docs on this because they weren't correct on this matter |
Beta Was this translation helpful? Give feedback.
-
Question: Do we need to manually call |
Beta Was this translation helpful? Give feedback.
-
it give synatx error
Beta Was this translation helpful? Give feedback.
All reactions