Skip to content

Commit

Permalink
Merge pull request #604 from Laravel-Backpack/add-option-to-redirect-…
Browse files Browse the repository at this point in the history
…after-the-entry-is-clones

add redirect after clone option
  • Loading branch information
pxpm authored Oct 4, 2024
2 parents 90a3307 + 9217d45 commit 319fb63
Showing 1 changed file with 9 additions and 0 deletions.
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

0 comments on commit 319fb63

Please sign in to comment.