diff --git a/config/turbo-laravel.php b/config/turbo-laravel.php
index 2eddf56d..242b01f2 100644
--- a/config/turbo-laravel.php
+++ b/config/turbo-laravel.php
@@ -58,7 +58,7 @@
|
*/
'features' => [
- Features::turboNativeRoutes(),
+ Features::hotwireNativeRoutes(),
],
/*
diff --git a/docs/csrf.md b/docs/csrf.md
index 09d1afc1..cabb3a90 100644
--- a/docs/csrf.md
+++ b/docs/csrf.md
@@ -20,4 +20,4 @@ Since Turbo.js intercepts form submissions and converts those to fetch requests
With that being said, you may still want to use the `@csrf` Blade directive if you want to support users with JavaScript disabled, since the forms will still work if they contain the CSRF token.
-[Continue to Turbo Native...](/docs/{{version}}/turbo-native)
+[Continue to Hotwire Native...](/docs/{{version}}/hotwire-native)
diff --git a/docs/helpers.md b/docs/helpers.md
index 1670d55a..7def2253 100644
--- a/docs/helpers.md
+++ b/docs/helpers.md
@@ -241,11 +241,11 @@ if (request()->wasFromTurboFrame(dom_id($post, 'create_comment'))) {
}
```
-### The `request()->wasFromTurboNative()` macro
+### The `request()->wasFromHotwireNative()` macro
-The `request()->wasFromTurboNative()` macro added to the request class will check if the request came from a Turbo Native client and returns `true` or `false` accordingly.
+The `request()->wasFromHotwireNative()` macro added to the request class will check if the request came from a Hotwire Native client and returns `true` or `false` accordingly.
-Turbo Native clients are encouraged to override the `User-Agent` header in the WebViews to mention the words `Turbo Native` on them. This is what this macro uses to detect if it came from a Turbo Native client.
+Hotwire Native clients are encouraged to override the `User-Agent` header in the WebViews to mention the words `Hotwire Native` on them. This is what this macro uses to detect if it came from a Hotwire Native client.
### The `response()->turboStream()` macro
diff --git a/docs/hotwire-native.md b/docs/hotwire-native.md
new file mode 100644
index 00000000..cb8db9c7
--- /dev/null
+++ b/docs/hotwire-native.md
@@ -0,0 +1,134 @@
+# Hotwire Native
+
+[TOC]
+
+## Introduction
+
+Hotwire also has a [mobile side](https://native.hotwired.dev/) and Turbo Laravel provides some helpers to help integrating with that.
+
+Turbo visits made by a Hotwire Native client should send a custom `User-Agent` header. Using that header, we can detect in the backend that a request is coming from a Hotwire Native client instead of a regular web browser.
+
+This is useful if you want to customize the behavior a little bit different based on that information. For instance,
+you may want to include some elements for mobile users, like a mobile-only CSS file include, for instance. To do that, you may use the `@hotwirenative` Blade directive in your Blade views:
+
+```blade
+@hotwirenative
+
+@endhotwirenative
+```
+
+Alternatively, you may want to include some elements only if the client requesting it is _NOT_ a Hotwire Native client using the `@unlesshotwirenative` Blade helpers:
+
+```blade
+@unlesshotwirenative
+
Hello, Non-Hotwire Native Users!
+@endunlesshotwirenative
+```
+
+You may also check if the request was made from a Hotwire Native visit using the request macro:
+
+```php
+if (request()->wasFromHotwireNative()) {
+ // ...
+}
+```
+
+Or the Turbo Facade directly, like so:
+
+```php
+use HotwiredLaravel\TurboLaravel\Facades\Turbo;
+
+if (Turbo::isHotwireNativeVisit()) {
+ // ...
+}
+```
+
+## Interacting With Hotwire Native Navigation
+
+Hotwire Native will hook into Turbo's visits so it displays them on mobile mimicking the mobile way of stacking screens instead of just replace elements on the same screen. This helps the native feel of our hybrid app.
+
+However, sometimes we may need to customize the behavior of form request handler to avoid a weird screen jumping effect happening on the mobile client. Instead of regular redirects, we can send some signals by redirecting to specific routes that are detected by the Hotwire Native client.
+
+For instance, if a form submission request came from a Hotwire Native client, the form was probably rendered on a native modal, which is not part of the screen stack, so we can just tell Turbo to `refresh` the current screen it has on stack instead. There are 3 signals we can send to the Hotwire Native client:
+
+| Signal | Route| Description|
+|---|---|---|
+| `recede` | `/recede_historical_location` | Go back to previous screen |
+| `resume` | `/resume_historical_location` | Stay on the current screen as is |
+| `refresh`| `/refresh_historical_location` | Stay on the current screen but refresh |
+
+Sending these signals is a matter of detecting if the request came from a Hotwire Native client and, if so, redirect the user to these signal URLs instead. The Hotwire Native client should detect the redirect was from one of these special routes and trigger the desired behavior.
+
+You may use the `InteractsWithHotwireNativeNavigation` trait on your controllers to achieve this behavior and fallback to a regular redirect if the request wasn't from a Hotwire Native client:
+
+```php
+use HotwiredLaravel\TurboLaravel\Http\Controllers\Concerns\InteractsWithHotwireNativeNavigation;
+
+class TraysController extends Controller
+{
+ use InteractsWithHotwireNativeNavigation;
+
+ public function store()
+ {
+ // Tray creation...
+
+ return $this->recedeOrRedirectTo(route('trays.show', $tray));
+ }
+}
+```
+
+In this example, when the request to create trays comes from a Hotwire Native client, we're going to redirect to the `/recede_historical_location` URL instead of the `trays.show` route. However, if the request was made from your web app, we're going to redirect the client to the `trays.show` route.
+
+There are a couple of redirect helpers available:
+
+```php
+$this->recedeOrRedirectTo(string $url);
+$this->resumeOrRedirectTo(string $url);
+$this->refreshOrRedirectTo(string $url);
+$this->recedeOrRedirectBack(string $fallbackUrl, array $options = []);
+$this->resumeOrRedirectBack(string $fallbackUrl, array $options = []);
+$this->refreshOrRedirectBack(string $fallbackUrl, array $options = []);
+```
+
+It's common to flash messages using the `->with()` method of the Redirect response in Laravel. However, since a Hotwire Native request will never actually redirect somewhere where the flash message will be rendered, the behavior of the `->with()` method was slightly modified too.
+
+If you're setting flash messages like this after a form submission:
+
+```php
+use HotwiredLaravel\TurboLaravel\Http\Controllers\Concerns\InteractsWithHotwireNativeNavigation;
+
+class TraysController extends Controller
+{
+ use InteractsWithHotwireNativeNavigation;
+
+ public function store()
+ {
+ // Tray creation...
+
+ return $this->recedeOrRedirectTo(route('trays.show', $tray))
+ ->with('status', __('Tray created.'));
+ }
+}
+```
+
+If a request was sent from a Hotwire Native client, the flashed messages will be added to the query string instead of flashed into the session like they'd normally be. In this example, it would redirect like this:
+
+```
+/recede_historical_location?status=Tray%20created.
+```
+
+In the Hotwire Native client, you should be able to intercept these redirects, retrieve the flash messages from the query string and create native toasts, if you'd like to.
+
+If the request wasn't from a Hotwire Native client, the message would be flashed into the session as normal, and the client would receive a redirect to the `trays.show` route in this case.
+
+If you don't want these routes enabled, feel free to disable them by commenting out the feature on your `config/turbo-laravel.php` file (make sure the Turbo Laravel configs are published):
+
+```php
+return [
+ 'features' => [
+ // Features::hotwireNativeRoutes(),
+ ],
+];
+```
+
+[Continue to Testing...](/docs/{{version}}/testing)
diff --git a/docs/index.md b/docs/index.md
index 8ec4b7fe..a58c7a52 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -11,6 +11,6 @@
* [Broadcasting](/docs/{{version}}/broadcasting)
* [Validation Response Redirects](/docs/{{version}}/validation-response-redirects)
* [CSRF Protection](/docs/{{version}}/csrf)
- * [Turbo Native](/docs/{{version}}/turbo-native)
+ * [Hotwire Native](/docs/{{version}}/hotwire-native)
* [Testing](/docs/{{version}}/testing)
* [Known Issues](/docs/{{version}}/known-issues)
diff --git a/docs/installation.md b/docs/installation.md
index 326ce425..b48d5695 100644
--- a/docs/installation.md
+++ b/docs/installation.md
@@ -3,7 +3,7 @@
Turbo Laravel can be installed via [Composer](https://getcomposer.org/):
```bash
-composer require hotwired-laravel/turbo-laravel:^2.0.0
+composer require hotwired-laravel/turbo-laravel
```
After installing the package, you may run the `turbo:install` Artisan command. This command will add the Turbo.js dependency to your `package.json` file (when you're using Vite and NPM) or to your `routes/importmap.php` file (when it detects that you're using [Importmap Laravel](https://github.com/tonysm/importmap-laravel)). It also publishes some files to your `resources/js` folder, which imports Turbo for you:
@@ -12,6 +12,6 @@ After installing the package, you may run the `turbo:install` Artisan command. T
php artisan turbo:install
```
-Note: Turbo used to work with Livewire, but somewhere around Livewire V3 the bridges stopped working. There's an open issue to investigate Livewire V3 compatibility. If you're into Livewire and would love to use Turbo in a Livewire app (maybe you want to augment your Livewire&Turbo app with Turbo Native or something like that), you're welcome to check out the issue and try to bring the compatibility back. If you wanted an application scaffolding like Laravel Breeze or Laravel Jetstream, checkout Turbo Breeze, our fork of Breeze that sets up a fresh Laravel app using Stimulus, Importmaps, TailwindCSS (via the CLI), and Turbo.
+Note: Turbo used to work with Livewire, but somewhere around Livewire V3 the bridges stopped working. There's an open issue to investigate Livewire V3 compatibility. If you're into Livewire and would love to use Turbo in a Livewire app (maybe you want to augment your Livewire & Turbo app with Hotwire Native or something like that), you're welcome to check out the issue and try to bring the compatibility back. If you wanted an application scaffolding like Laravel Breeze or Laravel Jetstream, checkout Turbo Breeze, our fork of Breeze that sets up a fresh Laravel app using Stimulus, Importmaps, TailwindCSS (via the CLI), and Turbo.
[Continue to Overview...](/docs/{{version}}/overview)
diff --git a/docs/testing.md b/docs/testing.md
index 68991a62..760aa6a4 100644
--- a/docs/testing.md
+++ b/docs/testing.md
@@ -6,7 +6,7 @@
Testing a Hotwired app is like testing a regular Laravel app. However, Turbo Laravel comes with a set of helpers that may be used to ease testing some aspects that are specific to Turbo:
-1. **Turbo HTTP Request Helpers**. When you may want to mimic a Turbo visit, or a Turbo Native visit, or a request coming from a Turbo Frame.
+1. **Turbo HTTP Request Helpers**. When you may want to mimic a Turbo visit, or a Hotwire Native visit, or a request coming from a Turbo Frame.
1. **Turbo Streams on HTTP Responses.** When you may want to test the Turbo Streams returned from HTTP requests.
1. **Turbo Stream Broadcasts.** When you're either using the broadcast methods on your models using the `Broadcasts` trait, or when you're using [Handmade Turbo Stream Broadcasts](https://turbo-laravel.com/docs/2.x/broadcasting#content-handmade-broadcasts).
@@ -69,9 +69,9 @@ class CreateCommentsTest extends TestCase
}
```
-### Acting as Turbo Native
+### Acting as Hotwire Native
-Additionally, when you're building a Turbo Native mobile app, you may want to issue a request pretending to be sent from a Turbo Native client. That's done by setting the `User-Agent` header to something that mentions the word `Turbo Native`. The `InteractsWithTurbo` trait also has a `$this->turboNative()` method you may use that automatically sets the header correctly:
+Additionally, when you're building a Hotwire Native mobile app, you may want to issue a request pretending to be sent from a Hotwire Native client. That's done by setting the `User-Agent` header to something that mentions the word `Hotwire Native`. The `InteractsWithTurbo` trait also has a `$this->hotwireNative()` method you may use that automatically sets the header correctly:
```php
use HotwiredLaravel\TurboLaravel\Testing\InteractsWithTurbo;
@@ -87,7 +87,7 @@ class CreateCommentsTest extends TestCase
$this->assertCount(0, $post->comments);
- $this->turboNative()->post(route('posts.comments.store', $post), [
+ $this->hotwireNative()->post(route('posts.comments.store', $post), [
'content' => 'Hello World',
])->assertOk();
@@ -97,9 +97,9 @@ class CreateCommentsTest extends TestCase
}
```
-When using this method, calls to `request()->wasFromTurboNative()` will return `true`. Additionally, the `@turbonative` and `@unlessturbonative` Blade directives will render as expected.
+When using this method, calls to `request()->wasFromHotwireNative()` will return `true`. Additionally, the `@hotwirenative` and `@unlesshotwirenative` Blade directives will render as expected.
-Additionally, a few macros were added to the `TestResponse` class to make it easier to assert based on the `recede`, `resume`, and `refresh` redirects using the specific assert methods:
+A few other macros were added to the `TestResponse` class to make it easier to assert based on the `recede`, `resume`, and `refresh` redirects using the specific assert methods:
| Method | Descrition |
|---|---|
@@ -107,7 +107,7 @@ Additionally, a few macros were added to the `TestResponse` class to make it eas
| `assertRedirectResume(array $with = [])` | Asserts that a redirect was returned to the `/resume_historical_location` route. |
| `assertRedirectRefresh(array $with = [])` | Asserts that a redirect was returned to the `/refresh_historical_location` route. |
-The `$with` param will ensure that not only the route is correct, but also any flashed message will be included in the query string:
+The `$with` argument will ensure that not only the route is correct, but also any flashed message will be included in the query string:
```php
use HotwiredLaravel\TurboLaravel\Testing\InteractsWithTurbo;
@@ -123,7 +123,7 @@ class CreateCommentsTest extends TestCase
$this->assertCount(0, $post->comments);
- $this->turboNative()->post(route('posts.comments.store', $post), [
+ $this->hotwireNative()->post(route('posts.comments.store', $post), [
'content' => 'Hello World',
])->assertRedirectRecede(['status' => __('Comment created.')]);
diff --git a/docs/turbo-native.md b/docs/turbo-native.md
deleted file mode 100644
index d441aedc..00000000
--- a/docs/turbo-native.md
+++ /dev/null
@@ -1,134 +0,0 @@
-# Turbo Native
-
-[TOC]
-
-## Introduction
-
-Hotwire also has a [mobile side](https://turbo.hotwired.dev/handbook/native) and Turbo Laravel provides some helpers to help integrating with that.
-
-Turbo visits made by a Turbo Native client should send a custom `User-Agent` header. Using that header, we can detect in the backend that a request is coming from a Turbo Native client instead of a regular web browser.
-
-This is useful if you want to customize the behavior a little bit different based on that information. For instance,
-you may want to include some elements for mobile users, like a mobile-only CSS file include, for instance. To do that, you may use the `@turbonative` Blade directive in your Blade views:
-
-```blade
-@turbonative
-
-@endturbonative
-```
-
-Alternatively, you may want to include some elements only if the client requesting it is _NOT_ a Turbo Native client using the `@unlessturbonative` Blade helpers:
-
-```blade
-@unlessturbonative
-
Hello, Non-Turbo Native Users!
-@endunlessturbonative
-```
-
-You may also check if the request was made from a Turbo Native visit using the request macro:
-
-```php
-if (request()->wasFromTurboNative()) {
- // ...
-}
-```
-
-Or the Turbo Facade directly, like so:
-
-```php
-use HotwiredLaravel\TurboLaravel\Facades\Turbo;
-
-if (Turbo::isTurboNativeVisit()) {
- // ...
-}
-```
-
-## Interacting With Turbo Native Navigation
-
-Turbo Native will hook into Turbo's visits so it displays them on mobile mimicking the mobile way of stacking screens instead of just replace elements on the same screen. This helps the native feel of our hybrid app.
-
-However, sometimes we may need to customize the behavior of form request handler to avoid a weird screen jumping effect happening on the mobile client. Instead of regular redirects, we can send some signals by redirecting to specific routes that are detected by the Turbo Native client.
-
-For instance, if a form submission request came from a Turbo Native client, the form was probably rendered on a native modal, which is not part of the screen stack, so we can just tell Turbo to `refresh` the current screen it has on stack instead. There are 3 signals we can send to the Turbo Native client:
-
-| Signal | Route| Description|
-|---|---|---|
-| `recede` | `/recede_historical_location` | Go back to previous screen |
-| `resume` | `/resume_historical_location` | Stay on the current screen as is |
-| `refresh`| `/refresh_historical_location` | Stay on the current screen but refresh |
-
-Sending these signals is a matter of detecting if the request came from a Turbo Native client and, if so, redirect the user to these signal URLs instead. The Turbo Native client should detect the redirect was from one of these special routes and trigger the desired behavior.
-
-You may use the `InteractsWithTurboNativeNavigation` trait on your controllers to achieve this behavior and fallback to a regular redirect if the request wasn't from a Turbo Native client:
-
-```php
-use HotwiredLaravel\TurboLaravel\Http\Controllers\Concerns\InteractsWithTurboNativeNavigation;
-
-class TraysController extends Controller
-{
- use InteractsWithTurboNativeNavigation;
-
- public function store()
- {
- // Tray creation...
-
- return $this->recedeOrRedirectTo(route('trays.show', $tray));
- }
-}
-```
-
-In this example, when the request to create trays comes from a Turbo Native client, we're going to redirect to the `/turbo_recede_historical_location` URL instead of the `trays.show` route. However, if the request was made from your web app, we're going to redirect the client to the `trays.show` route.
-
-There are a couple of redirect helpers available:
-
-```php
-$this->recedeOrRedirectTo(string $url);
-$this->resumeOrRedirectTo(string $url);
-$this->refreshOrRedirectTo(string $url);
-$this->recedeOrRedirectBack(string $fallbackUrl, array $options = []);
-$this->resumeOrRedirectBack(string $fallbackUrl, array $options = []);
-$this->refreshOrRedirectBack(string $fallbackUrl, array $options = []);
-```
-
-It's common to flash messages using the `->with()` method of the Redirect response in Laravel. However, since a Turbo Native request will never actually redirect somewhere where the flash message will be rendered, the behavior of the `->with()` method was slightly modified too.
-
-If you're setting flash messages like this after a form submission:
-
-```php
-use HotwiredLaravel\TurboLaravel\Http\Controllers\Concerns\InteractsWithTurboNativeNavigation;
-
-class TraysController extends Controller
-{
- use InteractsWithTurboNativeNavigation;
-
- public function store()
- {
- // Tray creation...
-
- return $this->recedeOrRedirectTo(route('trays.show', $tray))
- ->with('status', __('Tray created.'));
- }
-}
-```
-
-If a request was sent from a Turbo Native client, the flashed messages will be added to the query string instead of flashed into the session like they'd normally be. In this example, it would redirect like this:
-
-```
-/recede_historical_location?status=Tray%20created.
-```
-
-In the Turbo Native client, you should be able to intercept these redirects, retrieve the flash messages from the query string and create native toasts, if you'd like to.
-
-If the request wasn't from a Turbo Native client, the message would be flashed into the session as normal, and the client would receive a redirect to the `trays.show` route in this case.
-
-If you don't want these routes enabled, feel free to disable them by commenting out the feature on your `config/turbo-laravel.php` file (make sure the Turbo Laravel configs are published):
-
-```php
-return [
- 'features' => [
- // Features::turboNativeRoutes(),
- ],
-];
-```
-
-[Continue to Testing...](/docs/{{version}}/testing)
diff --git a/routes/turbo.php b/routes/turbo.php
index 6d8631fa..c43257c9 100644
--- a/routes/turbo.php
+++ b/routes/turbo.php
@@ -1,8 +1,8 @@
name('turbo_recede_historical_location');
-Route::get('resume_historical_location', [TurboNativeNavigationController::class, 'resume'])->name('turbo_resume_historical_location');
-Route::get('refresh_historical_location', [TurboNativeNavigationController::class, 'refresh'])->name('turbo_refresh_historical_location');
+Route::get('recede_historical_location', [HotwireNativeNavigationController::class, 'recede'])->name('turbo_recede_historical_location');
+Route::get('resume_historical_location', [HotwireNativeNavigationController::class, 'resume'])->name('turbo_resume_historical_location');
+Route::get('refresh_historical_location', [HotwireNativeNavigationController::class, 'refresh'])->name('turbo_refresh_historical_location');
diff --git a/src/Facades/Turbo.php b/src/Facades/Turbo.php
index 9453812f..b4015d84 100644
--- a/src/Facades/Turbo.php
+++ b/src/Facades/Turbo.php
@@ -14,8 +14,8 @@
*
* @mixin \HotwiredLaravel\TurboLaravel\Turbo
*
- * @method static bool isTurboNativeVisit()
- * @method static self setVisitingFromTurboNative()
+ * @method static bool isHotwireNativeVisit()
+ * @method static self setVisitingFromHotwireNative()
* @method static mixed broadcastToOthers(bool|\Closure $toOthers = true)
* @method static bool shouldBroadcastToOthers
* @method static string domId(Model $model, string $prefix = "")
diff --git a/src/Features.php b/src/Features.php
index 6401ab47..08736986 100644
--- a/src/Features.php
+++ b/src/Features.php
@@ -9,7 +9,15 @@ public static function enabled(string $feature)
return in_array($feature, config('turbo-laravel.features', []));
}
+ /**
+ * @deprecated use hotwireNativeRoutes
+ */
public static function turboNativeRoutes(): string
+ {
+ return static::hotwireNativeRoutes();
+ }
+
+ public static function hotwireNativeRoutes(): string
{
return 'turbo_routes';
}
diff --git a/src/Http/Controllers/Concerns/InteractsWithHotwireNativeNavigation.php b/src/Http/Controllers/Concerns/InteractsWithHotwireNativeNavigation.php
new file mode 100644
index 00000000..33f5c79e
--- /dev/null
+++ b/src/Http/Controllers/Concerns/InteractsWithHotwireNativeNavigation.php
@@ -0,0 +1,64 @@
+redirectToTurboNativeAction('recede', $url);
+ }
+
+ protected function resumeOrRedirectTo(string $url)
+ {
+ return $this->redirectToTurboNativeAction('resume', $url);
+ }
+
+ protected function refreshOrRedirectTo(string $url)
+ {
+ return $this->redirectToTurboNativeAction('refresh', $url);
+ }
+
+ protected function recedeOrRedirectBack(?string $fallbackUrl, array $options = [])
+ {
+ return $this->redirectToTurboNativeAction('recede', $fallbackUrl, 'back', $options);
+ }
+
+ protected function resumeOrRedirectBack(?string $fallbackUrl, array $options = [])
+ {
+ return $this->redirectToTurboNativeAction('resume', $fallbackUrl, 'back', $options);
+ }
+
+ protected function refreshOrRedirectBack(?string $fallbackUrl, array $options = [])
+ {
+ return $this->redirectToTurboNativeAction('refresh', $fallbackUrl, 'back', $options);
+ }
+
+ protected function redirectToTurboNativeAction(string $action, string $fallbackUrl, string $redirectType = 'to', array $options = [])
+ {
+ if (request()->wasFromTurboNative()) {
+ return TurboNativeRedirectResponse::createFromFallbackUrl($action, $fallbackUrl);
+ }
+
+ if ($redirectType === 'back') {
+ return redirect()->back($options['status'] ?? 302, $options['headers'] ?? [], $fallbackUrl);
+ }
+
+ return redirect($fallbackUrl);
+ }
+
+ protected function redirectToHotwireNativeAction(string $action, string $fallbackUrl, string $redirectType = 'to', array $options = [])
+ {
+ if (request()->wasFromTurboNative()) {
+ return TurboNativeRedirectResponse::createFromFallbackUrl($action, $fallbackUrl);
+ }
+
+ if ($redirectType === 'back') {
+ return redirect()->back($options['status'] ?? 302, $options['headers'] ?? [], $fallbackUrl);
+ }
+
+ return redirect($fallbackUrl);
+ }
+}
diff --git a/src/Http/Controllers/Concerns/InteractsWithTurboNativeNavigation.php b/src/Http/Controllers/Concerns/InteractsWithTurboNativeNavigation.php
index 8854f078..f24f11e7 100644
--- a/src/Http/Controllers/Concerns/InteractsWithTurboNativeNavigation.php
+++ b/src/Http/Controllers/Concerns/InteractsWithTurboNativeNavigation.php
@@ -4,48 +4,20 @@
use HotwiredLaravel\TurboLaravel\Http\TurboNativeRedirectResponse;
+/**
+ * @deprecated use InteractsWithHotwireNativeNavigation
+ */
trait InteractsWithTurboNativeNavigation
{
- protected function recedeOrRedirectTo(string $url)
- {
- return $this->redirectToTurboNativeAction('recede', $url);
- }
-
- protected function resumeOrRedirectTo(string $url)
- {
- return $this->redirectToTurboNativeAction('resume', $url);
- }
-
- protected function refreshOrRedirectTo(string $url)
- {
- return $this->redirectToTurboNativeAction('refresh', $url);
- }
-
- protected function recedeOrRedirectBack(?string $fallbackUrl, array $options = [])
- {
- return $this->redirectToTurboNativeAction('recede', $fallbackUrl, 'back', $options);
- }
-
- protected function resumeOrRedirectBack(?string $fallbackUrl, array $options = [])
- {
- return $this->redirectToTurboNativeAction('resume', $fallbackUrl, 'back', $options);
- }
-
- protected function refreshOrRedirectBack(?string $fallbackUrl, array $options = [])
- {
- return $this->redirectToTurboNativeAction('refresh', $fallbackUrl, 'back', $options);
- }
+ use InteractsWithHotwireNativeNavigation;
+ /**
+ * @deprecated use redirectToHotwireNativeAction
+ *
+ * @return TurboNativeRedirectResponse
+ */
protected function redirectToTurboNativeAction(string $action, string $fallbackUrl, string $redirectType = 'to', array $options = [])
{
- if (request()->wasFromTurboNative()) {
- return TurboNativeRedirectResponse::createFromFallbackUrl($action, $fallbackUrl);
- }
-
- if ($redirectType === 'back') {
- return redirect()->back($options['status'] ?? 302, $options['headers'] ?? [], $fallbackUrl);
- }
-
- return redirect($fallbackUrl);
+ return $this->redirectToHotwireNativeAction($action, $fallbackUrl, $redirectType, $options);
}
}
diff --git a/src/Http/Controllers/TurboNativeNavigationController.php b/src/Http/Controllers/HotwireNativeNavigationController.php
similarity index 85%
rename from src/Http/Controllers/TurboNativeNavigationController.php
rename to src/Http/Controllers/HotwireNativeNavigationController.php
index 4882296a..69e6ff61 100644
--- a/src/Http/Controllers/TurboNativeNavigationController.php
+++ b/src/Http/Controllers/HotwireNativeNavigationController.php
@@ -4,7 +4,7 @@
use Illuminate\Routing\Controller;
-class TurboNativeNavigationController extends Controller
+class HotwireNativeNavigationController extends Controller
{
public function recede()
{
diff --git a/src/Http/HotwireNativeRedirectResponse.php b/src/Http/HotwireNativeRedirectResponse.php
new file mode 100644
index 00000000..385adf8a
--- /dev/null
+++ b/src/Http/HotwireNativeRedirectResponse.php
@@ -0,0 +1,68 @@
+withQueryString((new static($fallbackUrl))->getQueryString());
+ }
+
+ /**
+ * Sets the flashed data via query strings when redirecting to Hotwire Native routes.
+ *
+ * @param string $key
+ * @param mixed $value
+ * @return static
+ */
+ public function with($key, $value = null)
+ {
+ $params = $this->getQueryString();
+
+ return $this->withoutQueryStrings()
+ ->setTargetUrl($this->getTargetUrl().'?'.http_build_query($params + [$key => urlencode($value)]));
+ }
+
+ /**
+ * Sets multiple query strings at the same time.
+ */
+ protected function withQueryString(array $params): static
+ {
+ foreach ($params as $key => $val) {
+ $this->with($key, $val);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Returns the query string as an array.
+ */
+ protected function getQueryString(): array
+ {
+ parse_str(str_contains($this->getTargetUrl(), '?') ? Str::after($this->getTargetUrl(), '?') : '', $query);
+
+ return $query;
+ }
+
+ /**
+ * Returns the target URL without the query strings.
+ */
+ protected function withoutQueryStrings(): self
+ {
+ $fragment = str_contains($this->getTargetUrl(), '#') ? Str::after($this->getTargetUrl(), '#') : '';
+
+ return $this->withoutFragment()
+ ->setTargetUrl(Str::before($this->getTargetUrl(), '?').($fragment ? "#{$fragment}" : ''));
+ }
+}
diff --git a/src/Http/Middleware/TurboMiddleware.php b/src/Http/Middleware/TurboMiddleware.php
index 66cbd92e..70442412 100644
--- a/src/Http/Middleware/TurboMiddleware.php
+++ b/src/Http/Middleware/TurboMiddleware.php
@@ -43,8 +43,8 @@ public function handle($request, Closure $next)
{
$this->encryptedCookies = $request->cookies->all();
- if ($this->turboNativeVisit($request)) {
- TurboFacade::setVisitingFromTurboNative();
+ if ($this->hotwireNativeVisit($request)) {
+ TurboFacade::setVisitingFromHotwireNative();
}
if ($requestId = $request->header('X-Turbo-Request-Id', null)) {
@@ -57,9 +57,9 @@ public function handle($request, Closure $next)
/**
* @param \Illuminate\Http\Request $request
*/
- private function turboNativeVisit($request): bool
+ private function hotwireNativeVisit($request): bool
{
- return Str::contains($request->userAgent(), 'Turbo Native');
+ return Str::contains($request->userAgent(), ['Hotwire Native', 'Turbo Native']);
}
/**
@@ -68,7 +68,7 @@ private function turboNativeVisit($request): bool
*/
private function turboResponse($response, Request $request)
{
- if (! $this->turboVisit($request) && ! $this->turboNativeVisit($request)) {
+ if (! $this->turboVisit($request) && ! $this->hotwireNativeVisit($request)) {
return $response;
}
@@ -88,7 +88,7 @@ private function turboResponse($response, Request $request)
// When throwing a ValidationException and the app uses named routes convention, we can guess
// the form route for the current endpoint, make an internal request there, and return the
- // response body with the form over a 422 status code, which is better for Turbo Native.
+ // response body with the form over a 422 status code (works better for Hotwire Native).
if ($response->exception instanceof ValidationException && ($formRedirectUrl = $this->guessFormRedirectUrl($request, $response->exception->redirectTo))) {
$response->setTargetUrl($formRedirectUrl);
diff --git a/src/Http/TurboNativeRedirectResponse.php b/src/Http/TurboNativeRedirectResponse.php
index 0e6eb3f3..a069e06b 100644
--- a/src/Http/TurboNativeRedirectResponse.php
+++ b/src/Http/TurboNativeRedirectResponse.php
@@ -2,67 +2,7 @@
namespace HotwiredLaravel\TurboLaravel\Http;
-use Illuminate\Http\RedirectResponse;
-use Illuminate\Support\Str;
-
-class TurboNativeRedirectResponse extends RedirectResponse
-{
- /**
- * Factory Method that builds a new instance of the TurboNativeRedirectResponse
- * with the given action and forwards the query strings from the given fallback
- * URL to the Turbo Native redirect ones.
- */
- public static function createFromFallbackUrl(string $action, string $fallbackUrl): self
- {
- return (new self(route("turbo_{$action}_historical_location")))
- ->withQueryString((new self($fallbackUrl))->getQueryString());
- }
-
- /**
- * Sets the flashed data via query strings when redirecting to Turbo Native routes.
- *
- * @param string $key
- * @param mixed $value
- * @return self
- */
- public function with($key, $value = null)
- {
- $params = $this->getQueryString();
-
- return $this->withoutQueryStrings()
- ->setTargetUrl($this->getTargetUrl().'?'.http_build_query($params + [$key => urlencode($value)]));
- }
-
- /**
- * Sets multiple query strings at the same time.
- */
- protected function withQueryString(array $params): self
- {
- foreach ($params as $key => $val) {
- $this->with($key, $val);
- }
-
- return $this;
- }
-
- /**
- * Returns the query string as an array.
- */
- protected function getQueryString(): array
- {
- parse_str(str_contains($this->getTargetUrl(), '?') ? Str::after($this->getTargetUrl(), '?') : '', $query);
-
- return $query;
- }
-
- /**
- * Returns the target URL without the query strings.
- */
- protected function withoutQueryStrings(): self
- {
- $fragment = str_contains($this->getTargetUrl(), '#') ? Str::after($this->getTargetUrl(), '#') : '';
-
- return $this->withoutFragment()
- ->setTargetUrl(Str::before($this->getTargetUrl(), '?').($fragment ? "#{$fragment}" : ''));
- }
-}
+/**
+ * @deprecated use HotwireNativeRedirectResponse
+ */
+class TurboNativeRedirectResponse extends HotwireNativeRedirectResponse {}
diff --git a/src/Testing/InteractsWithTurbo.php b/src/Testing/InteractsWithTurbo.php
index a7ba566d..b44e7b84 100644
--- a/src/Testing/InteractsWithTurbo.php
+++ b/src/Testing/InteractsWithTurbo.php
@@ -14,11 +14,19 @@ public function turbo(): self
return $this->withHeader('Accept', Turbo::TURBO_STREAM_FORMAT);
}
+ /**
+ * @deprecated use hotwireNative (but the User-Agent will change when yo do that!)
+ */
public function turboNative(): self
{
return $this->withHeader('User-Agent', 'Turbo Native Android; Mozilla: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.3 Mozilla/5.0 (Macintosh; Intel Mac OS X x.y; rv:42.0) Gecko/20100101 Firefox/43.4');
}
+ public function hotwireNative(): self
+ {
+ return $this->withHeader('User-Agent', 'Hotwire Native Android; Mozilla: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.3 Mozilla/5.0 (Macintosh; Intel Mac OS X x.y; rv:42.0) Gecko/20100101 Firefox/43.4');
+ }
+
public function fromTurboFrame(string $frame): self
{
return $this->withHeader('Turbo-Frame', $frame);
diff --git a/src/Turbo.php b/src/Turbo.php
index 93bbc578..b2abbf17 100644
--- a/src/Turbo.php
+++ b/src/Turbo.php
@@ -10,10 +10,10 @@ class Turbo
const TURBO_STREAM_FORMAT = 'text/vnd.turbo-stream.html';
/**
- * This will be used to detect if the request being made is coming from a Turbo Native visit
+ * This will be used to detect if the request being made is coming from a Hotwire Native visit
* instead of a regular visit. This property will be set on the TurboMiddleware.
*/
- private bool $visitFromTurboNative = false;
+ private bool $visitFromHotwireNative = false;
/**
* Whether or not the events should broadcast to other users only or to all.
@@ -25,14 +25,30 @@ class Turbo
*/
private ?string $turboRequestId = null;
+ /**
+ * @deprecated use isHotwireNativeVisit
+ */
public function isTurboNativeVisit(): bool
{
- return $this->visitFromTurboNative;
+ return $this->isHotwireNativeVisit();
}
+ /**
+ * @deprecated use setVisitingFromHotwireNative
+ */
public function setVisitingFromTurboNative(): self
{
- $this->visitFromTurboNative = true;
+ return $this->setVisitingFromHotwireNative();
+ }
+
+ public function isHotwireNativeVisit(): bool
+ {
+ return $this->visitFromHotwireNative;
+ }
+
+ public function setVisitingFromHotwireNative(): self
+ {
+ $this->visitFromHotwireNative = true;
return $this;
}
diff --git a/src/TurboServiceProvider.php b/src/TurboServiceProvider.php
index 1606124e..276c0be6 100644
--- a/src/TurboServiceProvider.php
+++ b/src/TurboServiceProvider.php
@@ -89,11 +89,19 @@ private function configureRoutes(): void
private function configureMacros(): void
{
Blade::if('turbonative', function () {
- return TurboFacade::isTurboNativeVisit();
+ return TurboFacade::isHotwireNativeVisit();
});
Blade::if('unlessturbonative', function () {
- return ! TurboFacade::isTurboNativeVisit();
+ return ! TurboFacade::isHotwireNativeVisit();
+ });
+
+ Blade::if('hotwirenative', function () {
+ return TurboFacade::isHotwireNativeVisit();
+ });
+
+ Blade::if('unlesshotwirenative', function () {
+ return ! TurboFacade::isHotwireNativeVisit();
});
Blade::directive('domid', function ($expression) {
@@ -128,7 +136,11 @@ private function configureRequestAndResponseMacros(): void
});
Request::macro('wasFromTurboNative', function (): bool {
- return TurboFacade::isTurboNativeVisit();
+ return TurboFacade::isHotwireNativeVisit();
+ });
+
+ Request::macro('wasFromHotwireNative', function (): bool {
+ return TurboFacade::isHotwireNativeVisit();
});
Request::macro('wasFromTurboFrame', function (?string $frame = null): bool {
diff --git a/tests/FunctionsTest.php b/tests/FunctionsTest.php
index c973ff00..5c53ccfc 100644
--- a/tests/FunctionsTest.php
+++ b/tests/FunctionsTest.php
@@ -16,7 +16,7 @@ class FunctionsTest extends TestCase
{
private Article $article;
- public function setUp(): void
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/Http/TurboNativeNavigationControllerTest.php b/tests/Http/HotwireNativeNavigationControllerTest.php
similarity index 73%
rename from tests/Http/TurboNativeNavigationControllerTest.php
rename to tests/Http/HotwireNativeNavigationControllerTest.php
index 7ee6acc8..c829d686 100644
--- a/tests/Http/TurboNativeNavigationControllerTest.php
+++ b/tests/Http/HotwireNativeNavigationControllerTest.php
@@ -5,7 +5,7 @@
use HotwiredLaravel\TurboLaravel\Testing\InteractsWithTurbo;
use HotwiredLaravel\TurboLaravel\Tests\TestCase;
-class TurboNativeNavigationControllerTest extends TestCase
+class HotwireNativeNavigationControllerTest extends TestCase
{
use InteractsWithTurbo;
@@ -30,6 +30,9 @@ public function recede_resume_or_refresh_when_native_or_redirect_when_not_withou
$this->turboNative()->post(route('trays.store'), ['return_to' => "{$action}_or_redirect"])
->assertRedirect(route("turbo_{$action}_historical_location"));
+
+ $this->hotwireNative()->post(route('trays.store'), ['return_to' => "{$action}_or_redirect"])
+ ->assertRedirect(route("turbo_{$action}_historical_location"));
}
/**
@@ -60,17 +63,35 @@ public function recede_resume_or_refresh_when_native_or_redirect_when_not_with_f
->assertRedirect(route("turbo_{$action}_historical_location", ['status' => urlencode(__('Tray created.'))]))
->assertSessionMissing('status');
+ // Hotwire Native redirect with only flash...
+ $this->hotwireNative()
+ ->post(route('trays.store'), ['return_to' => "{$action}_or_redirect", 'with' => true])
+ ->assertRedirect(route("turbo_{$action}_historical_location", ['status' => urlencode(__('Tray created.'))]))
+ ->assertSessionMissing('status');
+
// Turbo Native redirect with only flash & fragments...
$this->turboNative()
->post(route('trays.store'), ['return_to' => "{$action}_or_redirect", 'with' => true, 'fragment' => true])
->assertRedirect(route("turbo_{$action}_historical_location", ['status' => urlencode(__('Tray created.'))]).'#newly-created-tray')
->assertSessionMissing('status');
+ // Hotwire Native redirect with only flash & fragments...
+ $this->hotwireNative()
+ ->post(route('trays.store'), ['return_to' => "{$action}_or_redirect", 'with' => true, 'fragment' => true])
+ ->assertRedirect(route("turbo_{$action}_historical_location", ['status' => urlencode(__('Tray created.'))]).'#newly-created-tray')
+ ->assertSessionMissing('status');
+
// Turbo Native redirect with only flash & fragments & query...
$this->turboNative()
->post(route('trays.store'), ['return_to' => "{$action}_or_redirect", 'with' => true, 'fragment' => true, 'query' => true])
->assertRedirect(route("turbo_{$action}_historical_location", ['lorem' => 'ipsum', 'status' => urlencode(__('Tray created.'))]).'#newly-created-tray')
->assertSessionMissing('status');
+
+ // Hotwire Native redirect with only flash & fragments & query...
+ $this->hotwireNative()
+ ->post(route('trays.store'), ['return_to' => "{$action}_or_redirect", 'with' => true, 'fragment' => true, 'query' => true])
+ ->assertRedirect(route("turbo_{$action}_historical_location", ['lorem' => 'ipsum', 'status' => urlencode(__('Tray created.'))]).'#newly-created-tray')
+ ->assertSessionMissing('status');
}
/**
@@ -88,6 +109,9 @@ public function recede_resume_or_refresh_when_native_or_redirect_back(string $ac
$this->turboNative()->from(url('/past_place'))->post(route('trays.store'), ['return_to' => "{$action}_or_redirect_back"])
->assertRedirect(route("turbo_{$action}_historical_location"));
+
+ $this->hotwireNative()->from(url('/past_place'))->post(route('trays.store'), ['return_to' => "{$action}_or_redirect_back"])
+ ->assertRedirect(route("turbo_{$action}_historical_location"));
}
/** @test */
diff --git a/tests/Http/Middleware/TurboMiddlewareTest.php b/tests/Http/Middleware/TurboMiddlewareTest.php
index f184a771..fe4d38a7 100644
--- a/tests/Http/Middleware/TurboMiddlewareTest.php
+++ b/tests/Http/Middleware/TurboMiddlewareTest.php
@@ -48,13 +48,18 @@ public function handles_invalid_forms_with_an_internal_redirect_when_using_form_
}
/** @test */
- public function can_detect_turbo_native_visits()
+ public function can_detect_hotwire_native_visits()
{
ArticleFactory::new()->times(3)->create();
$this->assertFalse(
TurboFacade::isTurboNativeVisit(),
- 'Expected to not have started saying it is a Turbo Native visit, but it said it is.'
+ 'Expected to not have started saying it is a Hotwire Native visit, but it said it is.'
+ );
+
+ $this->assertFalse(
+ TurboFacade::isHotwireNativeVisit(),
+ 'Expected to not have started saying it is a Hotwire Native visit, but it said it is.'
);
$this->get('/articles', [
@@ -65,9 +70,22 @@ public function can_detect_turbo_native_visits()
],
]);
+ $this->get('/articles', [
+ 'User-Agent' => 'Hotwire Native Android',
+ ])->assertJsonStructure([
+ 'data' => [
+ '*' => ['id', 'title', 'content', 'created_at', 'updated_at'],
+ ],
+ ]);
+
$this->assertTrue(
TurboFacade::isTurboNativeVisit(),
- 'Expected to have detected a Turbo Native visit, but it did not.'
+ 'Expected to have detected a Hotwire Native visit, but it did not.'
+ );
+
+ $this->assertTrue(
+ TurboFacade::isHotwireNativeVisit(),
+ 'Expected to have detected a Hotwire Native visit, but it did not.'
);
}
diff --git a/tests/Http/RequestMacrosTest.php b/tests/Http/RequestMacrosTest.php
index f4d088ac..abaabc83 100644
--- a/tests/Http/RequestMacrosTest.php
+++ b/tests/Http/RequestMacrosTest.php
@@ -34,6 +34,16 @@ public function was_from_turbo_native()
$this->assertTrue($request->wasFromTurboNative());
}
+ /** @test */
+ public function was_from_hotwire_native()
+ {
+ $request = Request::create('/hello');
+ $this->assertFalse($request->wasFromHotwireNative());
+
+ TurboFacade::setVisitingFromTurboNative();
+ $this->assertTrue($request->wasFromHotwireNative());
+ }
+
/** @test */
public function was_from_turbo_frame()
{
diff --git a/tests/Http/TestResponseMacrosTest.php b/tests/Http/TestResponseMacrosTest.php
index 607757ff..6c315042 100644
--- a/tests/Http/TestResponseMacrosTest.php
+++ b/tests/Http/TestResponseMacrosTest.php
@@ -21,6 +21,10 @@ public function asserts_historical_locations_without_flashes($returnTo, $route,
$this->turboNative()->post(route('trays.store', 1), [
'return_to' => $returnTo,
])->assertRedirectToRoute($route)->{$method}();
+
+ $this->hotwireNative()->post(route('trays.store', 1), [
+ 'return_to' => $returnTo,
+ ])->assertRedirectToRoute($route)->{$method}();
}
/**
@@ -38,5 +42,12 @@ public function asserts_historical_locations_with_flashes($returnTo, $route, $me
])->assertRedirectToRoute($route, $with = [
'status' => urlencode(__('Tray created.')),
])->{$method}($with);
+
+ $this->hotwireNative()->post(route('trays.store', 1), [
+ 'return_to' => $returnTo,
+ 'with' => true,
+ ])->assertRedirectToRoute($route, $with = [
+ 'status' => urlencode(__('Tray created.')),
+ ])->{$method}($with);
}
}
diff --git a/tests/Models/NamingTest.php b/tests/Models/NamingTest.php
index 542658f6..40a8f89b 100644
--- a/tests/Models/NamingTest.php
+++ b/tests/Models/NamingTest.php
@@ -19,13 +19,13 @@ protected function setUp(): void
}
/** @test */
- public function className()
+ public function class_name()
{
$this->assertEquals(Models\User\Profile::class, $this->modelName->className);
}
/** @test */
- public function classNameWithoutRootNamespace()
+ public function class_name_without_root_namespace()
{
$this->assertEquals('User\\Profile', $this->modelName->classNameWithoutRootNamespace);
}
diff --git a/tests/Views/ViewHelpersTest.php b/tests/Views/ViewHelpersTest.php
index d92c8b2a..707514ff 100644
--- a/tests/Views/ViewHelpersTest.php
+++ b/tests/Views/ViewHelpersTest.php
@@ -3,8 +3,10 @@
namespace HotwiredLaravel\TurboLaravel\Tests\Views;
use HotwiredLaravel\TurboLaravel\Facades\Turbo;
+use HotwiredLaravel\TurboLaravel\Testing\InteractsWithTurbo;
use HotwiredLaravel\TurboLaravel\Tests\TestCase;
use Illuminate\Support\Facades\Blade;
+use PHPUnit\Framework\Attributes\Test;
use Workbench\App\Models\Article;
use Workbench\App\Models\ReviewStatus;
use Workbench\App\Models\User\Profile;
@@ -15,37 +17,55 @@
class ViewHelpersTest extends TestCase
{
+ use InteractsWithTurbo;
+
/** @test */
- public function renders_turbo_native_correctly()
+ public function renders_hotwire_native_correctly()
{
$article = ArticleFactory::new()->create();
- $this->assertFalse(Turbo::isTurboNativeVisit());
-
$this->get(route('articles.show', $article))
- ->assertDontSee('Visiting From Turbo Native');
+ ->assertDontSee('Visiting From Hotwire Native');
- Turbo::setVisitingFromTurboNative();
- $this->assertTrue(Turbo::isTurboNativeVisit());
+ $this->turboNative()
+ ->get(route('articles.show', $article))
+ ->assertSee('Visiting From Hotwire Native');
- $this->get(route('articles.show', $article))
- ->assertSee('Visiting From Turbo Native');
+ $this->hotwireNative()
+ ->get(route('articles.show', $article))
+ ->assertSee('Visiting From Hotwire Native');
}
/** @test */
- public function renders_unless_turbo_native()
+ public function renders_blade_native_helpers(): void
{
- $article = ArticleFactory::new()->create();
+ $this->assertEquals('Not Native', trim(Blade::render('@turbonative Yes Native @else Not Native @endturbonative')));
+ $this->assertEquals('Not Native', trim(Blade::render('@hotwirenative Yes Native @else Not Native @endhotwirenative')));
+ $this->assertEquals('Not Native', trim(Blade::render('@unlessturbonative Not Native @else Yes Native @endunlessturbonative')));
+ $this->assertEquals('Not Native', trim(Blade::render('@unlesshotwirenative Not Native @else Yes Native @endunlesshotwirenative')));
+
+ Turbo::setVisitingFromHotwireNative();
+
+ $this->assertEquals('Yes Native', trim(Blade::render('@turbonative Yes Native @else Not Native @endturbonative')));
+ $this->assertEquals('Yes Native', trim(Blade::render('@hotwirenative Yes Native @else Not Native @endhotwirenative')));
+ $this->assertEquals('Yes Native', trim(Blade::render('@unlessturbonative Not Native @else Yes Native @endunlessturbonative')));
+ $this->assertEquals('Yes Native', trim(Blade::render('@unlesshotwirenative Not Native @else Yes Native @endunlesshotwirenative')));
+ }
- $this->assertFalse(Turbo::isTurboNativeVisit());
+ /** @test */
+ public function renders_unless_hotwire_native()
+ {
+ $article = ArticleFactory::new()->create();
$this->get(route('articles.show', $article))
->assertSee('Index');
- Turbo::setVisitingFromTurboNative();
- $this->assertTrue(Turbo::isTurboNativeVisit());
+ $this->turboNative()
+ ->get(route('articles.show', $article))
+ ->assertDontSee('Back');
- $this->get(route('articles.show', $article))
+ $this->hotwireNative()
+ ->get(route('articles.show', $article))
->assertDontSee('Back');
}
diff --git a/workbench/resources/views/articles/create.blade.php b/workbench/resources/views/articles/create.blade.php
index deaefa5c..f67c691c 100644
--- a/workbench/resources/views/articles/create.blade.php
+++ b/workbench/resources/views/articles/create.blade.php
@@ -2,9 +2,9 @@
{{ __('New Article') }}