Replies: 1 comment
-
Without framework change I can achieve it by using this component. abstract class ResponseComponent extends Component implements Responsable
{
public function toResponse($request)
{
return new Response(Blade::renderComponent($this), 200, ['Content-Type' => 'text/html']);
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
before making any PR I want to confirm, if it is want Laravel team wants.
I do not like how blade does not have "strict" view data dependency and I've used view models to pass data to view.
I wanted to experiment with Components to skip the view models. I had to tweak the Laravel router to support it but I've managed to make it work.
Now PHPStan and other tools can check if I pass correct values to the "view" component.
Is this worth to add to framework or should I use my own solution without Laravel framework change?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions