Include below code on your model
use \Vortechron\Essentials\Traits\ModelEssentials;
use \Vortechron\Essentials\Traits\HasMedia;use \Vortechron\Essentials\Traits\Modeler;
Those traits add the ability to standardize your model with vfg. But behind the scene, we just normalize model attribute for front end.
<?php​namespace App;​use Illuminate\Database\Eloquent\Model;use Spatie\MediaLibrary\HasMedia\HasMedia;​class Page extends Model implements HasMedia{use \Vortechron\Essentials\Traits\ModelEssentials;​protected $fillable = ['slug', 'title', 'content', 'social_title', 'social_description'];​protected $appends = ['social_image'];​public function getSocialImageAttribute(){return $this->getMedia('social');}}​
Automatically inject _data_attribute when calling forModel() on model instance. Useful when developer want to include data related for that model
protected $forModel = ['categories'];​public function getCategoriesForModel(){// return categories list}​// results['_data_categories' => [...]]