hotwired-laravel / turbo-laravel

This package gives you a set of conventions to make the most out of Hotwire in Laravel.
https://turbo-laravel.com
MIT License
793 stars 48 forks source link

Add a `$request->wasFromTurboFrame()` macro #121

Closed tonysm closed 10 months ago

tonysm commented 10 months ago

We need to add a custom macro that checks if the request came from Turbo Frame, similarly than what we do with the wantsTurboStream() andwasFromTurboNative().

This new one should take an option $id param. When nothing is passed to it, should return true if there's a Turbo-Frame header in the request. When an $id param is given, it should also check if the value of the Turbo-Frame header is equal to the given $id. Otherwise, it returns false.