Closed selected-pixel-jameson closed 4 years ago
Hmm... any chance you've upgraded to PermissionManager v6 too, at the same time? I so, that might be the problem - there are breaking changes in PermissionManager v6 too: https://github.com/Laravel-Backpack/PermissionManager/releases/tag/6.0.0 (also documented as Step 9 in the Backpack 4.1 upgrade guide)
Yep. I went through that process as well making sure to run the migrations and rename all the guards. Like I stated above this all works. It just won't return any of the Roles unless I type something into the search box on the RolesCrudController list view.
"require": {
"php": "^7.2",
"algolia/algoliasearch-client-php": "^2.2",
"aws/aws-sdk-php": "^3.129",
"backpack/crud": "4.1.*",
"backpack/permissionmanager": "^6.0.0",
"doctrine/dbal": "^2.9",
"fideloper/proxy": "^4.0",
"guzzlehttp/guzzle": "~6.3.3",
"intervention/image": "^2.5",
"laravel/framework": "^6.18",
"laravel/passport": "^7.5",
"laravel/scout": "^7.2",
"laravel/tinker": "^2.0",
"league/flysystem-aws-s3-v3": "~1.0",
"maatwebsite/excel": "^3.1.16",
"ralouphie/mimey": "^2.1",
"sendgrid/sendgrid": "^7.4",
"spatie/laravel-permission": "^3.0",
"vimeo/laravel": "^5.4",
"webpatser/laravel-uuid": "^3.0"
},
If I type in 'a' in the search box it returns all the roles with an 'a' in their name correctly. It's just when the page initially loads and no search has been entered that it returns the error.
Well that's weird... I'm still not getting the same problem, the listing works fine for me:
Can you please drill down and see what's the cause of the 500 error? It should show up in your Chrome Developers Tools, Laravel-Debugbar or Laravel Telescope - whatever you prefer. On localhost the output of that AJAX call should be an entire error stack, which should help us understand what the problem is.
I’ve tried. It doesn’t print out anything but the 500 internal error message. I’ve looked in the Laravel Debug bar and can’t find anything in there either.
I know that’s not helpful, this is weird to me as well. I’m a seasoned dev and usually I can dig up more info.
Jameson W Parker
On Jul 7, 2020, at 3:20 AM, Cristian Tabacitu notifications@github.com wrote:
Well that's weird... I'm still not getting the same problem, the listing works fine for me:
Can you please drill down and see what's the cause of the 500 error? It should show up in your Chrome Developers Tools, Laravel-Debugbar or Laravel Telescope - whatever you prefer. On localhost the output of that AJAX call should be an entire error stack, which should help us understand what the problem is.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Ugh... that's nasty 😞
Then maybe you can go down the rabbit hole and see exactly what triggers the 500 error. Actually commenting out lines inside vendor/backpack/permissionmanager
to see what the problem is:
PermissionCrudController::setup()
PermissionCrudController::setupListOperation()
Thank you! I will take a look at that.
Jameson W Parker
On Jul 8, 2020, at 12:55 AM, Cristian Tabacitu notifications@github.com wrote:
Ugh... that's nasty 😞
Then maybe you can go down the rabbit hole and see exactly what triggers the 500 error. Actually commenting out lines inside vendor/backpack/permissionmanager to see what the problem is:
the route something inside PermissionCrudController::setup() something inside PermissionCrudController::setupListOperation() that's about it, I think... if anything's wrong, it should be there I guess... — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
I'm not sure if this helps, but it seems as if the error is being generated from an AJAX request to http://xxxxxxx/admin/role/search?.
Permission Crud Controller
class PermissionCrudController extends CrudController
{
use \Backpack\CRUD\app\Http\Controllers\Operations\ListOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\CreateOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\UpdateOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\DeleteOperation;
public function setup()
{
$this->role_model = $role_model = config('backpack.permissionmanager.models.role');
$this->permission_model = $permission_model = config('backpack.permissionmanager.models.permission');
$this->crud->setModel($permission_model);
$this->crud->setEntityNameStrings(trans('backpack::permissionmanager.permission_singular'), trans('backpack::permissionmanager.permission_plural'));
$this->crud->setRoute(backpack_url('permission'));
// deny access according to configuration file
if (config('backpack.permissionmanager.allow_permission_create') == false) {
$this->crud->denyAccess('create');
}
if (config('backpack.permissionmanager.allow_permission_update') == false) {
$this->crud->denyAccess('update');
}
if (config('backpack.permissionmanager.allow_permission_delete') == false) {
$this->crud->denyAccess('delete');
}
}
public function setupListOperation()
{
$this->crud->addColumn([
'name' => 'name',
'label' => trans('backpack::permissionmanager.name'),
'type' => 'text',
]);
if (config('backpack.permissionmanager.multiple_guards')) {
$this->crud->addColumn([
'name' => 'guard_name',
'label' => trans('backpack::permissionmanager.guard_type'),
'type' => 'text',
]);
}
}
Role Crud Controller
class RoleCrudController extends CrudController
{
use \Backpack\CRUD\app\Http\Controllers\Operations\ListOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\CreateOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\UpdateOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\DeleteOperation;
public function setup()
{
$this->role_model = $role_model = config('backpack.permissionmanager.models.role');
$this->permission_model = $permission_model = config('backpack.permissionmanager.models.permission');
$this->crud->setModel($role_model);
$this->crud->setEntityNameStrings(trans('backpack::permissionmanager.role'), trans('backpack::permissionmanager.roles'));
$this->crud->setRoute(backpack_url('role'));
// deny access according to configuration file
if (config('backpack.permissionmanager.allow_role_create') == false) {
$this->crud->denyAccess('create');
}
if (config('backpack.permissionmanager.allow_role_update') == false) {
$this->crud->denyAccess('update');
}
if (config('backpack.permissionmanager.allow_role_delete') == false) {
$this->crud->denyAccess('delete');
}
}
public function setupListOperation()
{
$this->crud->addColumn([
'name' => 'name',
'label' => trans('backpack::permissionmanager.name'),
'type' => 'text',
]);
$this->crud->addColumn([ // select_multiple: n-n relationship (with pivot table)
'label' => trans('backpack::permissionmanager.users'), // Table column heading
'type' => 'relationship_count',
'name' => 'users', // the method that defines the relationship in your Model
'wrapper' => [
'href' => function ($crud, $column, $entry, $related_key) {
return backpack_url('user?role='.$entry->getKey());
},
],
'suffix' => ' users',
]);
if (config('backpack.permissionmanager.multiple_guards')) {
$this->crud->addColumn([
'name' => 'guard_name',
'label' => trans('backpack::permissionmanager.guard_type'),
'type' => 'text',
]);
}
$this->crud->addColumn([
// n-n relationship (with pivot table)
'label' => ucfirst(trans('backpack::permissionmanager.permission_plural')),
'type' => 'select_multiple',
'name' => 'permissions', // the method that defines the relationship in your Model
'entity' => 'permissions', // the method that defines the relationship in your Model
'attribute' => 'name', // foreign key attribute that is shown to user
'model' => $this->permission_model, // foreign key model
'pivot' => true, // on create&update, do you need to add/delete pivot table entries?
]);
}
Also we have a custom UserCrudController so we are not using the one provided by permissionManager. Thus our Route for Permission Manager looks like this.
Route::group([
'namespace' => 'Backpack\PermissionManager\app\Http\Controllers',
'prefix' => config('backpack.base.route_prefix', 'admin'),
'middleware' => ['web', backpack_middleware()],
], function () {
Route::crud('permission', 'PermissionCrudController');
Route::crud('role', 'RoleCrudController');
});
And this is our permissionmanager config... also some custom items in here.
<?php
return [
/*
|--------------------------------------------------------------------------
| Models
|--------------------------------------------------------------------------
|
| Models used in the User, Role and Permission CRUDs.
|
*/
'models' => [
'user' => App\User::class,
'permission' => Backpack\PermissionManager\app\Models\Permission::class,
'role' => Backpack\PermissionManager\app\Models\Role::class,
],
/*
|--------------------------------------------------------------------------
| Disallow the user interface for creating/updating permissions or roles.
|--------------------------------------------------------------------------
| Roles and permissions are used in code by their name
| - ex: $user->hasPermissionTo('edit articles');
|
| So after the developer has entered all permissions and roles, the administrator should either:
| - not have access to the panels
| or
| - creating and updating should be disabled
*/
'allow_permission_create' => true,
'allow_permission_update' => true,
'allow_permission_delete' => true,
'allow_role_create' => true,
'allow_role_update' => true,
'allow_role_delete' => true,
/*
|--------------------------------------------------------------------------
| Multiple-guards functionality
|--------------------------------------------------------------------------
|
*/
'multiple_guards' => false,
'roles_with_admin_access' => ['admin', 'moderator', 'customer service'],
];
So I recompiled the app.js and I'm now getting a little bit more. When the error comes back it now returns this along with the 500 internal error.
Failed to load resource: net::ERR_INCOMPLETE_CHUNKED_ENCODING
I'm wondering if I might have an outdated version of jquery somehow?
Wow - never got that in Backpack, @selected-pixel-jameson , but I assume it's because the request is too large or something? Or that the actual JSON response gets trimmed somehow?!
I couldn't replicate this, so I'm going to close it - I'm pretty sure it has something to do with your custom files/implementation, rather than Backpack itself. Please let us know if you get to the bottom of this and it really is a Backpack bug. This is a weird one.
I think that I finally figured out what the issue is with this. The problem is that the interface lists out the user count. I have over 300k users assigned to a role and it seems to be breaking the query. If I manually search for any role other then the main one that contains all 300k users the UI loads fine, but the minute I search for that role it crashes.
Here is the stack trace.
[2020-09-01 19:50:46] local.ERROR: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 20480 bytes) {"userId":97303,"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalErrorException(code: 1): Allowed memory size of 2147483648 bytes exhausted (tried to allocate 20480 bytes) at /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php:43)
[stacktrace]
#0 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(148): Symfony\\Component\\Debug\\Exception\\FatalErrorException->__construct()
#1 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(134): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->fatalExceptionFromError()
#2 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(0): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleShutdown()
#3 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphToMany.php(155): Illuminate\\Database\\Eloquent\\Relations\\Pivot::fromAttributes()
#4 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php(506): Illuminate\\Database\\Eloquent\\Relations\\MorphToMany->newPivot()
#5 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php(822): Illuminate\\Database\\Eloquent\\Relations\\MorphToMany->newExistingPivot()
#6 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php(652): Illuminate\\Database\\Eloquent\\Relations\\MorphToMany->hydratePivotRelation()
#7 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Relation.php(144): Illuminate\\Database\\Eloquent\\Relations\\MorphToMany->get()
#8 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(585): Illuminate\\Database\\Eloquent\\Relations\\MorphToMany->getEager()
#9 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(554): Illuminate\\Database\\Eloquent\\Builder->eagerLoadRelation()
#10 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(522): Illuminate\\Database\\Eloquent\\Builder->eagerLoadRelations()
#11 /home/vagrant/code/healthmeans-laravel/vendor/backpack/crud/src/app/Library/CrudPanel/Traits/Read.php(99): Illuminate\\Database\\Eloquent\\Builder->get()
#12 /home/vagrant/code/healthmeans-laravel/vendor/backpack/crud/src/app/Http/Controllers/Operations/ListOperation.php(132): Backpack\\CRUD\\app\\Library\\CrudPanel\\CrudPanel->getEntries()
#13 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): Backpack\\PermissionManager\\app\\Http\\Controllers\\RoleCrudController->search()
#14 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): call_user_func_array:{/home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Routing/Controller.php:54}()
#15 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Backpack\\PermissionManager\\app\\Http\\Controllers\\RoleCrudController->callAction()
#16 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Routing/Route.php(219): Illuminate\\Routing\\ControllerDispatcher->dispatch()
#17 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Routing/Route.php(176): Illuminate\\Routing\\Route->runController()
#18 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Routing/Router.php(681): Illuminate\\Routing\\Route->run()
#19 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(130): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure:/home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Routing/Router.php:679-683}()
#20 /home/vagrant/code/healthmeans-laravel/vendor/backpack/crud/src/app/Http/Controllers/CrudController.php(43): Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure:/home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:128-136}()
#21 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(153): Backpack\\PermissionManager\\app\\Http\\Controllers\\RoleCrudController->Backpack\\CRUD\\app\\Http\\Controllers\\{closure:/home/vagrant/code/healthmeans-laravel/vendor/backpack/crud/src/app/Http/Controllers/CrudController.php:35-44}()
#22 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure:/home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:147-180}()
#23 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle()
#24 /home/vagrant/code/healthmeans-laravel/app/Http/Middleware/CheckIfAdmin.php(63): Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure:/home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:147-180}()
#25 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): App\\Http\\Middleware\\CheckIfAdmin->handle()
#26 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure:/home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:147-180}()
#27 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle()
#28 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(76): Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure:/home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:147-180}()
#29 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): App\\Http\\Middleware\\VerifyCsrfToken->handle()
#30 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure:/home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:147-180}()
#31 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle()
#32 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(56): Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure:/home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:147-180}()
#33 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\\Session\\Middleware\\StartSession->handle()
#34 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure:/home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:147-180}()
#35 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle()
#36 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(66): Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure:/home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:147-180}()
#37 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): App\\Http\\Middleware\\EncryptCookies->handle()
#38 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(105): Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure:/home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:147-180}()
#39 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Routing/Router.php(683): Illuminate\\Routing\\Pipeline->then()
#40 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Routing/Router.php(658): Illuminate\\Routing\\Router->runRouteWithinStack()
#41 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Routing/Router.php(624): Illuminate\\Routing\\Router->runRoute()
#42 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Routing/Router.php(613): Illuminate\\Routing\\Router->dispatchToRoute()
#43 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(170): Illuminate\\Routing\\Router->dispatch()
#44 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(130): App\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure:/home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:167-171}()
#45 /home/vagrant/code/healthmeans-laravel/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(65): Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure:/home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:128-136}()
#46 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle()
#47 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure:/home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:147-180}()
#48 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle()
#49 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure:/home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:147-180}()
#50 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): App\\Http\\Middleware\\TrimStrings->handle()
#51 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure:/home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:147-180}()
#52 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle()
#53 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(63): Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure:/home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:147-180}()
#54 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): App\\Http\\Middleware\\CheckForMaintenanceMode->handle()
#55 /home/vagrant/code/healthmeans-laravel/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure:/home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:147-180}()
#56 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): App\\Http\\Middleware\\TrustProxies->handle()
#57 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(105): Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure:/home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:147-180}()
#58 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(145): Illuminate\\Routing\\Pipeline->then()
#59 /home/vagrant/code/healthmeans-laravel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(110): App\\Http\\Kernel->sendRequestThroughRouter()
#60 /home/vagrant/code/healthmeans-laravel/public/index.php(55): App\\Http\\Kernel->handle()
#61 /home/vagrant/code/healthmeans-laravel/public/index.php(0): {main}()
#62 {main}
"}
@tabacitu Do you have any wonderful insight into how to figure this issue possibly? I'm not sure if it's a Backpack Issue or a Spatie Permissions Manager issue.
The underlying issue is that I have 300k+ user accounts and the query is inefficient and thus it times out before it can return the count on these users.
@pxpm Any insight into this? This has been an issue for a few months and it pretty much prevents us from using the Roles Admin interface as I can't expect admins to understand they need to search for a specific role for it to show up. This happens on all of our environments so it can't be a memory issue and if it is then something needs to be re-worked with the way this is queried.
Just stumbled unto this and I think the solution needs a few more details - not sure if at the time we solved this in a different issue and what that issue is.
THE PROBLEM was most likely that the relationship_count
column is sub-optimal. When used on big tables it'll bring them to a stall.
THE SOLUTION is to use the text
column type instead, to achieve the exact same thing:
/**
* Show a column with the number of users that have that particular role.
*
* Note: To account for the fact that there can be thousands or millions
* of users for a role, we did not use the `relationship_count` column,
* but instead opted to append a fake `user_count` column to
* the result, using Laravel's `withCount()` method.
* That way, no users are loaded.
*/
$this->crud->query->withCount('users');
$this->crud->addColumn([
'label' => trans('backpack::permissionmanager.users'),
'type' => 'text',
'name' => 'users_count',
'wrapper' => [
'href' => function ($crud, $column, $entry, $related_key) {
return backpack_url('user?role='.$entry->getKey());
},
],
'suffix' => ' users',
]);
Hope this help someone someday.
Here is the issue @tabacitu was refering to: https://github.com/Laravel-Backpack/CRUD/issues/3227 and the PR that fixed it: https://github.com/Laravel-Backpack/PermissionManager/pull/256
Best, Pedro
Bug report
What I did
I updated from Laravel 4.0 to Laravel 4.1 with the spatie/permissions manager. Everything is working great, however when I navigate to the Roles controller it will not load anything. I just get a 500 internal error in the console that doesn't return a message. It also doesn't log anything in the laravel.log file.
The interesting thing is if I enter a value in the search box it will return values. So it appears as if it doesn't like it when a empty search is being done.
What I expected to happen
I expect that when the Roles Controller is initially loaded it shows all oft he available Roles.
What happened
Nothing is loaded and a 500 internal error with no response is returned for the request to http://[mydomain]/admin/role/search?
What I've already tried to fix it
I've gone over the documentation numerous times confirming that I have the guards and all of the configurations set correctly. I've posted a question on Stackoverflow and gotten no legitimate responses.
Backpack, Laravel, PHP, DB version
PHP 7.3.15-3+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Feb 23 2020 07:23:33) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.15, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.3.15-3+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
LARAVEL VERSION:
v6.18.19@69321afec31f4a908112e5dc8995fc91024fd971
BACKPACK VERSION:
4.1.8@393a054490c97721186deb9faed20c6ed70ef6ef