<?php // Operations here require 'WidgetsOperations.php'; // Widgets here $widgets = ['latest_users_graph' => Laralum::lineChart($latest_users_graph['title'], $latest_users_graph['element_label'], $latest_users_graph['labels'], $latest_users_graph['data']), 'latest_posts_graph' => Laralum::lineChart($latest_posts_graph['title'], $latest_posts_graph['element_label'], $latest_posts_graph['labels'], $latest_posts_graph['data']), 'users_country_pie_graph' => Laralum::pieChart($users_country_pie_graph['title'], $users_country_pie_graph['labels'], $users_country_pie_graph['data']), 'users_country_geo_graph' => Laralum::geoChart($users_country_geo_graph['title'], $users_country_geo_graph['element_label'], $users_country_geo_graph['data']), 'roles_users' => Laralum::barChart($roles_users['title'], $roles_users['element_label'], $roles_users['labels'], $roles_users['data']), 'basic_stats_1' => "\n <div class='ui doubling stackable three column grid container'>\n <div class='column'>\n <center>\n <div class='ui statistic'>\n <div class='value'>\n " . count(Laralum::users()) . "\n </div>\n <div class='label'>\n " . trans('laralum.users') . "\n </div>\n </div>\n </center>\n </div>\n <div class='column'>\n <center>\n <div class='ui statistic'>\n <div class='value'>\n " . count(Laralum::roles()) . "\n </div>\n <div class='label'>\n " . trans('laralum.roles') . "\n </div>\n </div>\n </center>\n </div>\n <div class='column'>\n <center>\n <div class='ui statistic'>\n <div class='value'>\n " . count(Laralum::permissions()) . "\n </div>\n <div class='label'>\n " . trans('laralum.permissions') . "\n </div>\n </div>\n </center>\n </div>\n </div>\n ", 'basic_stats_2' => "\n <div class='ui doubling stackable three column grid container'>\n <div class='column'>\n <center>\n <div class='ui statistic'>\n <div class='value'>\n " . count(Laralum::posts()) . "\n </div>\n <div class='label'>\n " . trans('laralum.posts') . "\n </div>\n </div>\n </center>\n </div>\n <div class='column'>\n <center>\n <div class='ui statistic'>\n <div class='value'>\n " . count(Laralum::postViews()) . "\n </div>\n <div class='label'>\n " . trans('laralum.post_views') . "\n </div>\n </div>\n </center>\n </div>\n <div class='column'>\n <center>\n <div class='ui statistic'>\n <div class='value'>\n " . count(Laralum::comments()) . "\n </div>\n <div class='label'>\n " . trans('laralum.comments') . "\n </div>\n </div>\n </center>\n </div>\n </div>\n "];
} $users_country_pie_graph['title'] = trans('laralum.users_graph2'); $users_country_pie_graph['labels'] = []; $users_country_pie_graph['data'] = []; foreach ($g_labels as $g_label) { array_push($users_country_pie_graph['labels'], $countries[$g_label]); array_push($users_country_pie_graph['data'], count(Laralum::users('country_code', $g_label))); } /* |-------------------------------------------------------------------------- | users_country_geo_graph |-------------------------------------------------------------------------- */ $g_labels = []; foreach (Laralum::users() as $user) { $add = true; foreach ($g_labels as $g_label) { if ($g_label == $user->country_code) { $add = false; } } if ($add) { array_push($g_labels, $user->country_code); } } $users_country_geo_graph['title'] = trans('laralum.users_graph2'); $users_country_geo_graph['element_label'] = trans('laralum.users'); $users_country_geo_graph['data'] = []; foreach ($g_labels as $g_label) { array_push($users_country_geo_graph['data'], [$g_label, count(Laralum::users('country_code', $g_label))]); }