C
C
CrimsonFox2022-01-19 07:17:38
Laravel
CrimsonFox, 2022-01-19 07:17:38

How to bind several variables for different databases in a common query?

Good afternoon everyone,
I have a task to make a report based on the selection of several attributes
. And it turns out that all of them are directly tied to one database, but among them there is a search by floors that I can’t bind to the program in any way

//index
$level = [2,3,4,5,6];
 public function getReport(Request $request)
    { 
$start_date = $request->get('start_date', date('d.m.Y'));
        $date_end = $request->get('date_end', date('d.m.Y'));

       //$level_id = DB::select('select * from room where level_id = :level', ['level' > 1]); 
        $level_id = Room::where( 'level_id', '=', $request['level']+2)->select('number')->get();
        $habitation =  Habitation::with([ "places"])
        ->where('status','=','saselen')
        ->whereDate('dogovor_date','>=',$start_date)
        ->whereDate('dogovor_date','<=',$date_end)

        ->get();    
        
        return view('admin.admissionRep.report',compact('habitation', 'level_id', 'start_date','date_end'));
    }

while the program sees $level_id, but does not associate it with the program.
61e790171a6a5896937262.png
how can this be fixed?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question