Пример #1
0
 public function asns(Request $request)
 {
     $limit = $request->input('limit');
     if (is_numeric($limit) !== true || $limit < 1 || $limit > 100) {
         $limit = 20;
     }
     $asns = ASN::paginate($limit);
     foreach ($asns as $asn) {
         $asnData['asn'] = $asn->asn;
         $asnData['name'] = $asn->name;
         $asnData['description_short'] = $asn->description;
         $asnData['country_code'] = empty($asn->counrty_code) !== true ? $asn->counrty_code : null;
         $output[] = $asnData;
     }
     $data = $this->makeStatus();
     $data['results_count'] = $asns->total();
     $data['current_page'] = $asns->currentPage();
     $data['limit'] = $asns->perPage();
     $data['data'] = $output;
     return $this->respond($data);
 }