Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to undefined method addVisible #567

Closed
Tracked by #148
WebVPF opened this issue Jun 3, 2022 · 4 comments
Closed
Tracked by #148

Call to undefined method addVisible #567

WebVPF opened this issue Jun 3, 2022 · 4 comments
Milestone

Comments

@WebVPF
Copy link
Contributor

WebVPF commented Jun 3, 2022

Winter CMS Build

dev-develop

PHP Version

8.0

Database engine

MySQL/MariaDB

Plugins installed

custom

Issue description

Winter CMS - 1.2

When I try to export, I get an error:

"Call to undefined method WebVPF\Custom\Models\Item::addVisible()" on line 71 of www\vendor\laravel\framework\src\Illuminate\Support\Traits\ForwardsCalls.php

I do export according to the example from the official documentation https://wintercms.com/docs/backend/import-export#export-model

class SubscriberExport extends \Backend\Models\ExportModel
{
    public function exportData($columns, $sessionKey = null)
    {
        $subscribers = Subscriber::all();
        $subscribers->each(function($subscriber) use ($columns) {
            $subscriber->addVisible($columns);
        });
        return $subscribers->toArray();
    }
}

Steps to replicate

Export Implementation

Workaround

No response

@WebVPF WebVPF added needs review Issues/PRs that require a review from a maintainer Type: Unconfirmed Bug labels Jun 3, 2022
@TheFehr
Copy link

TheFehr commented Jun 4, 2022

I can confirm this.
My upgraded october code base has the same problem.

@bennothommo bennothommo added this to the v1.2.0 milestone Jun 5, 2022
@bennothommo bennothommo added Type: Bug and removed Type: Unconfirmed Bug needs review Issues/PRs that require a review from a maintainer labels Jun 5, 2022
@bennothommo
Copy link
Member

Laravel 7 dropped the addVisible / addHidden methods (upgrade note here) in favour of makeVisible / makeHidden. You can switch to those methods if you wish as a workaround, but we'll likely have to re-add these in as they were in our docs.

@WebVPF
Copy link
Contributor Author

WebVPF commented Jun 5, 2022

@bennothommo Thank you!
Replaced addVisible method with makeVisible method. The export worked.

$subscriber->addVisible($columns);

$subscriber->makeVisible($columns);

bennothommo added a commit to wintercms/storm that referenced this issue Jun 24, 2022
It is recommended to use "makeVisible" / "makeHidden" in new code going forward.

Fixes wintercms/winter#567
@bennothommo
Copy link
Member

Restored the addVisible / addHidden methods as of wintercms/storm@1643791.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants