Voyager: [Laravel 5.4] Missing role_id from user create/edit query

Created on 19 Feb 2017  路  8Comments  路  Source: the-control-group/voyager

  • Laravel Version: 5.4.12
  • Voyager Version: 0.11.0
  • PHP Version: 5.6.25

Description:

role_id not stored when add/edit the user.
Laravel debugbar shows below query :-

insert into users (name, email, password, avatar, updated_at, created_at) values ('Test user one', '@.com', '*', 'users/default.png', '2017-02-19 13:25:20', '2017-02-19 13:25:20')

Apparently role_id is missing from query. which folder do I need to modify?

help wanted possible bug

Most helpful comment

Reference: #799

All 8 comments

What is the user model called?

Sorry, I'm very new to laravel and voyager :( So not sure how to find it but the debugbar shows below. Does it help?

uri : POST admin/users
middleware : web, admin.user
as : voyager.users.store
controller : \TCG\Voyager\Http\Controllers\VoyagerBreadController@store
namespace : App\Http\Controllers
prefix : /admin
where
file : \vendor\tcg\voyager\src\Http\Controllers\VoyagerBreadController.php:202-220

Below query returns name, email, password, avatar only. so I edit the database data_rows columns add as 1, edit as 1 (default setting was all 0 apart from required) so it seems to be working.
which columns should be 1? brows, read and delete should be 1 as well?

select * from data_rows where data_rows.data_type_id = '3' and data_rows.data_type_id is not null and add = '1'

I think just need to change the file of \vendor\tcg\voyager\publishable\database\seeds\DataRowsTableSeeder.php

But not sure which one should be 1 ??

$dataRow = $this->dataRow($userDataType, 'role_id');
if (!$dataRow->exists) {
$dataRow->fill([
'type' => 'text',
'display_name' => 'role_id',
'required' => 1,
'browse' => 0,
'read' => 0,
'edit' => 0,
'add' => 0,
'delete' => 0,
'details' => '',
])->save();
}

It's first time to comment github so not sure how to display the code nicely! Sorry

You just need add permission to Edit the 'role_id' column

go to:
http:// {YOUR DOMAIN} /admin/database/bread/users/edit

and edit checkboxes in below in screenshot
image

@ArmSALArmy Cheers, yip it works as well :)

Reference: #799

This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.

Was this page helpful?
0 / 5 - 0 ratings