Protoqol / Prequel

Prequel for Laravel. Clear and concise database management. Unfortunately, not actively maintained due to time constraints.

Home Page:https://packagist.org/packages/protoqol/prequel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Fields are not shown when using the $visible property

stevenberg opened this issue · comments

Describe the bug
When a model class uses the $visible property to hide attributes, attributes that are not included in the $visible array are not shown in Prequel.

To Reproduce
Use the $visible property instead of $hidden:

protected $visible = [
    'created_at',
    'email',
    'id',
    'name',
    'updated_at',
];

Screenshots
Expected view:
Screen Shot 2019-07-18 at 9 54 59 AM

Actual view:
Screen Shot 2019-07-18 at 9 52 48 AM

Fix
I think this can be fixed by changing line 76 of DatabaseController.php from

$paginated->setCollection($paginated->getCollection()->makeVisible($hidden));

to

$paginated->getCollection()->each->setHidden([])->each->setVisible([]);

Which removes both the $hidden and $visible properties from the objects in the collection.

Thanks for including a fix! Included in next release.