Skip to content

Commit

Permalink
[Hexlet#704] add array for default filter parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimirkuvanovv committed Mar 24, 2021
1 parent 9c9ec3b commit 8cb9750
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions app/Http/Controllers/SolutionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ class SolutionController extends Controller
{
public function index(Request $request): View
{
$filter = $request->input('filter');

if (!$filter) {
$filter = ['user_id' => 0, 'exercise_id' => 0];
}
$filter = array_merge(
['user_id' => 0, 'exercise_id' => 0],
$request->input('filter') ?? []
);

$solutions = QueryBuilder::for(Solution::versioned())
->allowedFilters([
Expand Down

0 comments on commit 8cb9750

Please sign in to comment.