Skip to content

Commit

Permalink
Enforce columns that we can sort on
Browse files Browse the repository at this point in the history
  • Loading branch information
turbo124 committed Feb 18, 2024
1 parent 26a7e73 commit 9d5e11a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/Filters/PaymentFilters.php
Expand Up @@ -12,8 +12,9 @@
namespace App\Filters;

use App\Models\Payment;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Eloquent\Builder;

/**
* PaymentFilters.
Expand Down Expand Up @@ -163,7 +164,7 @@ public function sort(string $sort = ''): Builder
{
$sort_col = explode('|', $sort);

if (!is_array($sort_col) || count($sort_col) != 2) {
if (!is_array($sort_col) || count($sort_col) != 2 || !in_array($sort_col, Schema::getColumnListing('payments'))) {
return $this->builder;
}

Expand Down

0 comments on commit 9d5e11a

Please sign in to comment.