Level 73
As your question and relationships are not very clear, maybe you can take advantage of a helper to reverse the slug like this answer here:
https://laracasts.com/discuss/channels/laravel/is-there-a-laravel-helper-to-reverse-a-slug
I want to get the model title based on that slug.
Here is how I get the model from database :
{{ $news->model }}
This returns me
rebecca-david
and what I wanted to do is to get the value of title based on slug from models :
Rebecca David
Here is my controller:
public function newsSingle($news_category, $model, $id, $slug)
{
// return $slug;
$data = $this->data;
$data['news'] = News::with('category_name','news_image','models','creative')
->where('slug','=',$slug)
->orWhere('id','=',$id)
->orWhere('model','=',$model)
->orWhere('news_category','=',$news_category)
->first();
}
I need to get model-title from table models, column title based on that slug .
As your question and relationships are not very clear, maybe you can take advantage of a helper to reverse the slug like this answer here:
https://laracasts.com/discuss/channels/laravel/is-there-a-laravel-helper-to-reverse-a-slug
Please or to participate in this conversation.