Exemplo n.º 1
0
 public function index()
 {
     // STATISTIK
     $dbinbox = Inbox::statistic();
     foreach ($dbinbox as $key) {
         $category[] = $key->periode;
         $inbox[] = $key->total;
     }
     $dbsent = Sent::statistic();
     foreach ($dbsent as $key) {
         $sent[] = $key->total;
     }
     $dbsent_api = Sent::statistic('apis');
     foreach ($dbsent_api as $key) {
         $sent_api[] = $key->total;
     }
     $dbsent_keyword = Sent::statistic('keywords');
     foreach ($dbsent_keyword as $key) {
         $sent_keyword[] = $key->total;
     }
     $dbsent_user = Sent::statistic('users');
     foreach ($dbsent_user as $key) {
         $sent_user[] = $key->total;
     }
     if (\Request::ajax()) {
         $data = [['name' => 'Kotak Masuk', 'data' => $inbox], ['name' => 'Terkirim', 'data' => $sent], ['name' => 'Api', 'data' => $sent_api], ['name' => 'Kata Kunci', 'data' => $sent_keyword], ['name' => 'User', 'data' => $sent_user]];
         return \Response::json($data, 200, [], JSON_NUMERIC_CHECK);
     } else {
         $signal = Modem::select('Signal')->first();
         return view('home')->with('data', ['signal' => $signal['Signal'], 'category' => $category]);
     }
 }
Exemplo n.º 2
0
 public function show($id)
 {
     if (\Request::ajax()) {
         $data = Modem::find($id);
         if ($data) {
             return \Response::json($data);
         } else {
             return \Response::json(null, 404);
         }
     } else {
         abort(404);
     }
 }