Prevent queries from unrelated tables

This commit is contained in:
David Bomba 2024-09-26 15:02:19 +10:00
parent 69834c9362
commit 6afcb90ba4

View File

@ -255,7 +255,7 @@ abstract class QueryFilters
public function client_id(string $client_id = ''): Builder public function client_id(string $client_id = ''): Builder
{ {
if (strlen($client_id) == 0) { if (strlen($client_id) == 0 || !in_array('vendor_id', \Illuminate\Support\Facades\Schema::getColumnListing($this->builder->getModel()->getTable()))) {
return $this->builder; return $this->builder;
} }
@ -264,7 +264,7 @@ abstract class QueryFilters
public function vendor_id(string $vendor_id = ''): Builder public function vendor_id(string $vendor_id = ''): Builder
{ {
if (strlen($vendor_id) == 0) { if (strlen($vendor_id) == 0 || !in_array('vendor_id', \Illuminate\Support\Facades\Schema::getColumnListing($this->builder->getModel()->getTable()))) {
return $this->builder; return $this->builder;
} }