Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add redirect after clone option #604

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions 6.x/crud-operation-clone.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ class ProductCrudController extends CrudController
CRUD::setModel(\App\Models\Product::class);
CRUD::setRoute(backpack_url('product'));
CRUD::setEntityNameStrings('product', 'products');

// optionally you can redirect the user after the clone operation succeeds
// if you set the `redirect_after_clone` option to true, it defaults to the edit page
$this->crud->set('clone.redirect_after_clone', true);

// you can also use a closure to define the redirect URL
$this->crud->set('clone.redirect_after_clone', function($entry) {
return backpack_url('product/'.$entry->id.'/show'); // redirect to show view instead of edit
});
}
}
```
Expand Down