1. Go to this page and download the library: Download asivas/analytics-dashboard library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
asivas / analytics-dashboard example snippets
namespace App\Facades;
use App\Analytics\SomeMetricsIndicator;
class Analytics
{
/**
** IMPORTANT ** This method must be present, otherwise getWidgetData won't be able to build the proper response
*/
public function getWidget($analyticsName):Widget {
$dwc = new DashboardWidgetController();
return $dwc->getWidget($analyticsName);
}
//** */
public function someMetricsIndicator($from,$to,$params = null)
{
return SomeMetricsIndicator::getData($from,$to,$params);
}
// TODO: create the methods similiar to someMetricsIndicator with your criteria
}
namespace App\Http\Controllers\Dashboard;
use Asivas\Analytics\Http\Controllers\Dashboard\DashboardWidgetController as AsivasDashboardWidgetController;
class DashboardWidgetController extends AsivasDashboardWidgetController
{
....
}
use App\Facades\Analytics;
use App\Http\Controllers\Dashboard\DashboardWidgetController;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
$this->app->bind('Analytics', function($app) {
return new Analytics();
});
$this->app->bind('WidgetController', function($app) {
return new DashboardWidgetController();
});
}
...