ErrorException in Taggable.php line 34:Trying to get property of non-object
- in Taggable.php line 34
- at HandleExceptions->handleError('8', 'Trying to get property of non-object', '/app/Models/Taggable.php', '34',array('tag' => object(stdClass), 'tagInfo' => null)) in Taggable.php line 34
- at Taggable::App\Models\{closure}(object(stdClass), '4')
- at array_map(object(Closure), array(object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass),object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass),object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass)), array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19')) in Collection.php line 469
- at Collection->map(object(Closure))
- at call_user_func_array(array(object(Collection), 'map'), array(object(Closure))) in AbstractPaginator.php line 475
- at AbstractPaginator->__call('map', array(object(Closure))) in Taggable.php line 35
- at LengthAwarePaginator->map(object(Closure)) in Taggable.php line 35
- at Taggable::App\Models\{closure}() in Repository.php line 206
- at Repository->remember('hot_tags', '10', object(Closure))
之前好好的, 请问这是什么问题?看了下提示错误的 代码:
/*全局热门标签*/
public static function globalHotTags()
{
return Cache::remember('hot_tags',10,function(){
$tags = self::hottest(25);
$tags->map(function($tag){
$tagInfo = Tag::find($tag->tag_id);
$tag->name = $tagInfo->name;
});
return $tags;
});
}