Hi,
I have a model with an One To Many relationship, and I need to get 1 record of the main model with the pagination of the records of the relationships.
You can simply add an accessor where you assign the paginator
public function getRelationPaginationAttribute($count = 20)
{
return $this->relation()->paginate($count);
}
public function relation()
{
return $this->hasMany(App\Relation::class);
}