andreixfr's avatar

How to get model name based on her 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 .

0 likes
1 reply

Please or to participate in this conversation.