corcel / acf

Advanced Custom Fields (ACF) plugin for Corcel
127 stars 100 forks source link

Repeater dont work with Taxonomy #39

Closed SamuelNCarvalho closed 7 years ago

SamuelNCarvalho commented 7 years ago

Repeater in taxonomy is not working.

Type error: Argument 2 passed to Corcel\Acf\Field\Repeater::fetchPostsMeta() must be an instance of Corcel\Post, instance of Corcel\Term given, called in D:\Samuel\Jobs\Giraffas\source\laravel\vendor\corcel\acf\src\Field\Repeater.php on line 30.

Code:

$category = Taxonomy::with('parentTerm')->with('term')->whereHas('term', function($query) use ($categorySlug){
            $query->whereSlug($categorySlug);
        })->first();

$category->acf->repeater('repeater_field');

What is wrong?

SamuelNCarvalho commented 7 years ago

Pull Request done. #40