public function products($telegramid) { if ($telegramid != $this->support_channel) { $merchant = Merchant::where('chat_id', $telegramid)->first(); if ($merchant) { $products = $merchant->products()->get(); $reponse = []; $reponse['status_code'] = "200"; $reponse['state'] = "true"; $reponse['message'] = "Products retrived successfully "; $reponse['products'] = $products; return $reponse; } else { $reponse = []; $reponse['status_code'] = "400"; $reponse['state'] = "false"; $reponse['message'] = "Merchant does not exist"; return $reponse; } } else { $reponse = []; $reponse['status_code'] = "211"; $reponse['state'] = "false"; $reponse['message'] = "You need to link your store to your telegram channel. Type /register to get started"; return $reponse; } }