Closed btrumsey closed 1 month ago
Hey @btrumsey thanks for the heads up, and for providing a possible solution.
I've just released backpack/devtools 3.1.7
with the fix. I decided to not use regex as you suggested because it could also leave other use cases missing, like for example when extending models:
class ModelB
{
use CrudTrait;
}
class ModelA extends ModelB
{
}
I've changed the script to use \Reflection
instead so all use cases are covered.
Please allow a few moments for our private repository to pick the released changes and you can get the updated version with a composer update backpack/devtools
👍
Please let us know if you are still experiencing issues 🙏
Cheers
Bug report
What I did
Viewing my models in DevTools incorrectly flags models as not using CrudTrait.
What I expected to happen
Any model using CrudTrait should be checked in the Model list view.
What happened
Any model that does not specify CrudTrait as the first entry after the
use
statement will show as not using CrudTrait.What I've already tried to fix it
The error is in the
getHasCrudTraitAttribute
function inModel.php
. The check is being done with acontains
call, which will require an exact match:Updating this to use a regular expression will properly identify the usage of
CrudTrait
:Is it a bug in the latest version of Backpack?
Yes
Backpack, Laravel, PHP, DB version
When I run
php artisan backpack:version
the output is: