Releases: inertiajs/inertia-laravel
Releases Β· inertiajs/inertia-laravel
v0.6.8
v0.6.7
v0.6.6
v0.6.5
v0.6.4
v0.6.3
v0.6.2
v0.6.1
v0.6.0
Automatic redirects
Since returning a Redirect::back()
response is such a common pattern within an Inertia app, this adapter now does this automatically for you when no response is returned from a controller (#350).
For example, consider this teams controller which redirects back to the previous page after updating a team. With this new feature you can now omit the Redirect::back()
response and it will happen automatically.
class TeamsController extends Controller
{
public function update(Team $team)
{
$team->update(/* ... */);
-
- return Redirect::back();
}
}
You can disable this behavior, or even do something entirely different, by adding an onEmptyResponse
method to your HandleInertiaRequests
middleware:
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
/**
* Determines what to do when an Inertia action returned with no response.
* By default, we'll redirect the user back to where they came from.
*
* @param Request $request
* @param Response $response
* @return Response
*/
public function onEmptyResponse(Request $request, Response $response): Response
{
// Use the default Laravel "empty" response
return $response;
}