Voyager: Additions to User BREAD not reflected in Browse, Edit

Created on 14 Apr 2017  路  12Comments  路  Source: the-control-group/voyager

  • Laravel Version: 5.4.18
  • Voyager Version: 0.11.9
  • PHP Version: 7.0.9

Description:

When I add columns to the User database table, and update the BREAD accordingly, they are not reflected in the edit view.

I could modify the generated view in /storage/framework/views/, but that seems like a bad idea.

Would this require manually overriding the views?

Most helpful comment

Found a way to get this to work. It's painful, but ends up working out (nothing else tried above, or in #1100 worked fully).

  1. Add your custom columns to your database

  2. Create a view file to include the new columns you've created (add the inputs to the form, match the name exactly).

  3. Take screen shots, or record the field values, on the "Edit BREAD for users table' page. It is found at 'Dashboard>Database>Users>Bread>Edit'.

  4. DELETE BREAD for the users table.

  5. Click the 'Add BREAD to this table' link, and match settings backed up in step 3 above.

  6. Go to your 'Roles' page, and add back all permissions regarding the Users table and views.

This will add all your custom columns to the Bread, and let you set permissions for the new columns in the users table. It's cumbersome, but it works.

(edited to remove suggestion to edit core files). Adrian, you must be missing a step in the explanation, couldn't get it to work using your way. thx.

All 12 comments

1100 Solution for you.

@AdrianKuriata, Issue 1100 is not related to this.

@stinklikeonion, Please review the Laravel documentation on how to override package views. Though I don't believe this would be necessary for your specific issue. Please provide a screenshot of both the BREAD editor for that table, as well as the edit form view.

I'm fine with overriding the views if need be. But I'd certainly prefer to use Voyager's bread system. It just does not appear that the edit view pulls from the same file on users as it does for all the other db tables.

user-edit
user-bread

Unfortunately, Voyager does use custom views for the User model. You can find these under vendor/tcg/voyager/resources/views/user/

Found a way to get this to work. It's painful, but ends up working out (nothing else tried above, or in #1100 worked fully).

  1. Add your custom columns to your database

  2. Create a view file to include the new columns you've created (add the inputs to the form, match the name exactly).

  3. Take screen shots, or record the field values, on the "Edit BREAD for users table' page. It is found at 'Dashboard>Database>Users>Bread>Edit'.

  4. DELETE BREAD for the users table.

  5. Click the 'Add BREAD to this table' link, and match settings backed up in step 3 above.

  6. Go to your 'Roles' page, and add back all permissions regarding the Users table and views.

This will add all your custom columns to the Bread, and let you set permissions for the new columns in the users table. It's cumbersome, but it works.

(edited to remove suggestion to edit core files). Adrian, you must be missing a step in the explanation, couldn't get it to work using your way. thx.

Those steps are way more complicated than they should be. Please don't suggest anyone edit files under vendor (except perhaps temporarily for testing purposes, or similar). Please see my previous comment for instructions on how to properly override views.

Additionally, you shouldn't have to delete and recreate the BREAD settings. All database table columns/fields should automatically show up. If they don't, you should be able to just "edit bread" for that table, and save again after configuring the new fields. You will, however, still need to override the view as I mentioned in a previous comment.

I think my solution is the best, don't editing vendor original Voyager files and working perfectly. But what i know :D

Hi @bbowser, just to let you know that currently we can order BREAD items. It's a recent feature.

Like @fletch3555 mentioned, never update vendor files!!

so it麓s necessary to make a custom User edit-add to include custom table columns to the user bread view?

You can override users.edit-add to just include bread.edit-add
Browse View is not overriden, just add your columns thorugh BREAD.

how to include a field like user has many addresses or user has many documents? How could one include this type of field? Inline?
Where I could find some examples?
Thanks...

This issue has been closed for ~18 months... please ask in slack or open your own issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

popica80 picture popica80  路  3Comments

rayqiri picture rayqiri  路  3Comments

wislem picture wislem  路  3Comments

iwasherefirst2 picture iwasherefirst2  路  3Comments

zzpwestlife picture zzpwestlife  路  3Comments