Protoqol / Prequel

Prequel for Laravel. Clear and concise database management. Unfortunately, not actively maintained due to time constraints.
https://packagist.org/packages/protoqol/prequel
MIT License
1.54k stars 96 forks source link

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

Closed stevenberg closed 5 years ago

stevenberg commented 5 years ago

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.

QuintenJustus commented 5 years ago

Thanks for including a fix! Included in next release.