Show the route as well. How does that url look when rendered?
Feb 19, 2022
2
Level 1
Still Unable To Get The Parent Category Slug For Sub Categories
I'm back Laravel community. I previously posted on how to automatically get the parent category slug for the sub categories, sub sub categories and the sub sub sub categories pages. Independently, I can get the slugs for the sub categories and so on automatically, no problem. But when I try to incorporate the parent category slug, I continue to get errors. Trying to post
{category}
Doesn't have any effect. I'm sure I put together the appropriate model relationships. I can call the parent category slug with this relationship
public function catsubliner() {
return $this->belongsTo(HairBlogCategory::class,'category_id','id');
}
But I continue to get a 404 error. I'm trying to use the URL::to method like this
{{ URL::to('/natural-hair-blogs/s').'/'.$subcategory->catsubliner->slug.'/'.$subcategory->slug }}
Any help is appreciated.
Please or to participate in this conversation.