diff --git a/app/Http/Controllers/Licenses/LicensesController.php b/app/Http/Controllers/Licenses/LicensesController.php index 458b1ce15b..37d30af6ac 100755 --- a/app/Http/Controllers/Licenses/LicensesController.php +++ b/app/Http/Controllers/Licenses/LicensesController.php @@ -304,13 +304,16 @@ class LicensesController extends Controller $response = new StreamedResponse(function () { // Open output stream $handle = fopen('php://output', 'w'); - $licenses= License::with('company', + $licenses = License::with('company', 'manufacturer', 'category', 'supplier', 'adminuser', - 'assignedusers') - ->orderBy('created_at', 'DESC'); + 'assignedusers'); + if (request()->filled('category_id')) { + $licenses = $licenses->where('category_id', request()->input('category_id')); + } + $licenses = $licenses->orderBy('created_at', 'DESC'); Company::scopeCompanyables($licenses) ->chunk(500, function ($licenses) use ($handle) { $headers = [