user(); if ($request->has('send_email') && $request->get('send_email') && $request->missing('output')) { SendToAdmin::dispatch($user->company(), $request->all(), PurchaseOrderItemExport::class, $this->filename); return response()->json(['message' => 'working...'], 200); } $hash = \Illuminate\Support\Str::uuid(); PreviewReport::dispatch($user->company(), $request->all(), PurchaseOrderItemExport::class, $hash); return response()->json(['message' => $hash], 200); } }