FatalThrowableError: Call to a member function pluck() on string
huntercarter opened this issue · comments
James Hunter Carter commented
I'm getting this error
(1/1) FatalThrowableError
Call to a member function pluck() on string
in TaggableTrait.php (line 193)
when calling setTags(). However tag() works fine.
Any advice would be appreciated.
Bruno Gaspar commented
What version of the package and Laravel are you using?
Also, how to reproduce the issue?
James Hunter Carter commented
Laravel 5.4, and V.4.0.* of tags.
To trigger the exception, try running tag() and setTags() with a vanilla model, such as this:
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Cartalyst\Tags\TaggableTrait;
use Cartalyst\Tags\TaggableInterface;
class URL extends Model implements TaggableInterface
{
use TaggableTrait;
}
?>
Bruno Gaspar commented
I'm not able to reproduce this.
I used the model you just pasted (just renamed it to Url
instead of URL
) and ran the following:
$url = App\Url::first();
$url->setTags(['tag one', 'tag two']);
var_dump($url->tags->pluck('slug'));
It works as expected.
The test suite is all green so it must be something else.