Backpack for Laravel page_or_link field

I have started using the Backpack for Laravel recently. It is an excellent CRUD generator, does not get in your way, and with the latest repeatable field is a great candidate for my “go-to” backend manager.

I was making a menu for a new website, and tried “page_or_link” field, copy/pasted the syntax from the documentation, but it would not update the page_id or link fields. Googled around, it seems that no one has had this problem (???).

So I got to digging into the Backpacks Menu Manager plugin and found that the correct syntax for the name field is 'name' => ['type', 'link', 'page_id']. So, the correct field type code for setupCreateOperation() function is:

    'name' => ['type', 'link', 'page_id'],
    'label' => 'Type',
    'type' => 'page_or_link',
    'page_model' => '\Backpack\PageManager\app\Models\Page'

Leave a Reply