File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -73,11 +73,20 @@ public static function getByPotentials(array $potentials)
7373
7474 public static function getQueryByPotentials (array $ potentials )
7575 {
76- $ q = self ::query ()
77- ->whereJsonContains ('potentials->area_cores ' , $ potentials ['area_codes ' ])
78- ->whereJsonContains ('potentials->specialisation_codes ' , $ potentials ['specialisation_codes ' ], 'OR ' )
79- ->whereJsonContains ('potentials->transportation_codes ' , $ potentials ['transportation_codes ' ], 'OR ' )
80- ;
76+ $ q = self ::query ();
77+
78+ if ($ potentials ['area_codes ' ]) {
79+ $ q ->whereJsonContains ('potentials->area_cores ' , $ potentials ['area_codes ' ], 'OR ' );
80+ }
81+
82+ if ($ potentials ['specialisation_codes ' ]) {
83+ $ q ->whereJsonContains ('potentials->specialisation_codes ' , $ potentials ['specialisation_codes ' ], 'OR ' );
84+ }
85+
86+ if ($ potentials ['transportation_codes ' ]) {
87+ $ q ->whereJsonContains ('potentials->transportation_codes ' , $ potentials ['transportation_codes ' ], 'OR ' );
88+ }
89+
8190 return $ q ;
8291 }
8392}
Original file line number Diff line number Diff line change @@ -64,11 +64,20 @@ public static function getByPotentials(array $potentials)
6464
6565 public static function getQueryByPotentials (array $ potentials )
6666 {
67- $ q = self ::query ()
68- ->whereJsonContains ('potentials->area_cores ' , $ potentials ['area_codes ' ])
69- ->whereJsonContains ('potentials->specialisation_codes ' , $ potentials ['specialisation_codes ' ], 'OR ' )
70- ->whereJsonContains ('potentials->transportation_codes ' , $ potentials ['transportation_codes ' ], 'OR ' )
71- ;
67+ $ q = self ::query ();
68+
69+ if ($ potentials ['area_codes ' ]) {
70+ $ q ->whereJsonContains ('potentials->area_cores ' , $ potentials ['area_codes ' ], 'OR ' );
71+ }
72+
73+ if ($ potentials ['specialisation_codes ' ]) {
74+ $ q ->whereJsonContains ('potentials->specialisation_codes ' , $ potentials ['specialisation_codes ' ], 'OR ' );
75+ }
76+
77+ if ($ potentials ['transportation_codes ' ]) {
78+ $ q ->whereJsonContains ('potentials->transportation_codes ' , $ potentials ['transportation_codes ' ], 'OR ' );
79+ }
80+
7281 return $ q ;
7382 }
7483
You can’t perform that action at this time.
0 commit comments