Conditions | 5 |
Paths | 3 |
Total Lines | 19 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
16 | public function postLookup() { |
||
17 | $foreignKey = decrypt(request('foreign_key')); |
||
|
|||
18 | $foreignValue = request('foreign_value'); |
||
19 | $table = decrypt(request('table')); |
||
20 | $sqlCondition = decrypt(request('sql_condition')); |
||
21 | if($foreignKey && $foreignValue && $table) { |
||
22 | |||
23 | $data = DB::table($table) |
||
24 | ->where($foreignKey, $foreignValue); |
||
25 | if($sqlCondition) { |
||
26 | $data->whereRaw($sqlCondition); |
||
27 | } |
||
28 | |||
29 | $data = $data->get(); |
||
30 | |||
31 | return response()->json(['status'=>true, 'data'=>$data]); |
||
32 | |||
33 | }else{ |
||
34 | return response()->json(['status'=>false]); |
||
35 | } |
||
37 | } |