I’m getting an error when rendering a model Blogs
My errors:
Call to undefined method AppModelsBlog::getContent()
Can you suggest what is the cause of the error.
Model code given below
<?php
namespace AppModels;
use IlluminateDatabaseEloquentFactoriesHasFactory;
use IlluminateDatabaseEloquentModel;
use AppModelsCategories;
class Blog extends Model
{
public $table = "blogs";
protected $fillable = [
'id',
'category_id',
'title_ru',
'title_ua',
'slug',
'img',
'img_min',
'url',
'duration',
'annotation_ru',
'annotation_ua',
'description_ru',
'description_ua',
'meta_ru',
'meta_ua',
'keywords_ru',
'keywords_ua',
'views',
'type_record',
'schedule',
'published',
'created_at',
'updated_at'
];
public function category()
{
return $this->belongsTo(Categories::class);
}
public function scopePublished($query)
{
return $query->where('published', true);
}
}
This code helps to call the model Blog.