Search code examples
laravellaravel-backpacklaravel-backpack-5

Laravel-Backpack redirect to custom URL after create operation?


I have a situation like this, company->contact (one to many),

How can I redirect to contact/create with company id after the company created?

and where the save option configured, I am trying to remove 'Save and edit this item' option just from the Company create operation

array:2 [▼
  "active" => array:2 [▼
    "value" => "save_and_back"
    "label" => "Save and back"
  ]
  "options" => array:2 [▼
    "save_and_edit" => "Save and edit this item"
    "save_and_new" => "Save and new item"
  ]
] ```

Solution

  • You can configure your save actions in your CrudController.

    For example:

    public function setupCreateOperation()
    {
        CRUD::removeSaveAction('save_and_edit');
    }
    

    Have a look at: https://backpackforlaravel.com/docs/6.x/crud-save-actions#default-save-actions

    Cheers