Getting data from multiple tables via Laravel Eloquent

Posted 2 months ago by bobmyles

I have three tables; rate_params, review_form_languages, and review_form_translations. And corresponding models RateParam, ReviewFormLanguage and reviewFormTranslation.

rate_params has columns id, info_message, order and validation.

review_form_languages has id and name

review_form_translations has id, rate_params_id, review_form_languages_id, and text.

I would like to have query that fetches all the data from rate_params and the text from review_form_translations where review_form_languages.name is the passed parameter.

I have a query that fetches all the data from RateParam model as below

 $reviewForm = RateParam::select(
        'rate_params.id',
        'rate_params.validation',
        'rate_params.info_message',
    )->orderBy('order', 'asc')->get()->toArray();
    

How do I join to get the text from review_form_translations where review_form_languages.name is the passed parameter?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.