Fresh install Laravel + Statamic + Debugbar. I just published all the scafold in this repo for convinience if you like. Just clone, setup your env including database, and php artisan migrate:fresh --seed. You will have a super user with admin@statamic.test and password as password.
Extra Detail
Login to the control panel and Laravel Debugbar will show like 50ish duplicate queries
select * from `users` where `id` = 1 limit 1
select * from `group_user` where `user_id` = 1
In AuthServiceProvider you will find a couple of Gates like:
Gate::define('do-something', function (User $user) {
return $user->super = true;
});
Gate::define('do-something-else', function (User $user) {
return $user->super = true;
});
then in post.blade.php you'll find @can directives using those gates, that also generate duplicate queries.
This is a follow up on https://github.com/statamic/cms/issues/1511
Bug Description
When Storing Users in a Database, N+1 query problems show up here and there.
How to Reproduce
Fresh install Laravel + Statamic + Debugbar. I just published all the scafold in this repo for convinience if you like. Just clone, setup your env including database, and
php artisan migrate:fresh --seed
. You will have a super user withadmin@statamic.test
andpassword
as password.Extra Detail
Login to the control panel and Laravel Debugbar will show like 50ish duplicate queries
In AuthServiceProvider you will find a couple of Gates like:
then in
post.blade.php
you'll find@can
directives using those gates, that also generate duplicate queries.Environment
Statamic version: 3.1.6
PHP version: 7.4
Install method (choose one): fresh Laravel + install Statamic + Laravel Debugbar