Closed mikev032 closed 4 years ago
For example:
Wizard::routes('wizard/user', 'UserWizardController', 'wizard.user', [
'done_url' => 'new_done',
]);
The new done url is /wizard/user/new_done
.
Try it yourself, define a named route like so:
Route::get('/', 'HomeController@index')->name('home');
Wizard::routes('{User}/wizard/user', 'Wizards\UserWizard', 'wizard.user, [ 'done_url' => route('home'), ]);
It also don't work with the redirect()
element
If I am correct understanding we only allow hard coded url?
This is the case now.
I add it to the todo list.
I later thought of another solution, in the WizardController's done
method redirect to another URL:
<?php
...
use Ycs77\LaravelWizard\Wizardable;
class UserWizardController
{
use Wizardable;
public function done()
{
return redirect()->route('home');
}
}
There is no need to set 'done_url'
attribute for Wizard::routes
.
Ok Ill give it a shot later, I keep you updated 👍
Is your feature request related to a problem? Please describe. Would be awesome if we would be able to set a redirect route when the wizard is done: In your controller
protected $redirectRoute = route('my-route')
Describe the solution you'd like Make it possible we can redirect if not already exist
Right now I can extend the trait and overwrite the
getActionUrl()
and check if the method = 'done' but it feels a bit funny