M
M
Morfeey2019-02-14 12:44:19
Laravel
Morfeey, 2019-02-14 12:44:19

Requests, can you help with a request?

The essence of the task:
From the combined tables, output some statistics data to an Excel file for download.
I'm sitting scratching my head what's wrong with the code. Help.)

Report::select("report.position", "report.report_date", "phrase.name")
                ->leftJoin("phrases", function ($join) use ($request) {
                    $join->on("reports.phrase_id", "=", "phrases.id")
                        ->where("phrase.site_id", "=", $request->site["id"]);
                });

As a result, I get a builder. How to get a normal array of data from this? I tried to get them with the "->get()" stub, but it doesn't work.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Barmunk, 2019-02-14
@Barmunk

the table is called phrases and in where phrase .site_id and phrase .name
https://laravel.com/docs/5.7/eloquent#retrieving-models
https://laravel.com/docs/5.7/queries#selects
get() - get everything

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question