Repository URL to install this package:
|
Version:
0.2.1 ▾
|
<?php namespace Modules\Courses\Widgets;
use Modules\Core\Foundation\Widgets\BaseWidget;
use Modules\Courses\Services\CourseService;
class CourseWidget extends BaseWidget
{
/**
* @var CourseService
*/
private $service;
public function __construct(CourseService $service)
{
$this->service = $service;
}
/**
* Get the widget name
* @return string
*/
protected function name()
{
return 'CourseWidget';
}
/**
* Get the widget view
* @return string
*/
protected function view()
{
return 'courses::admin.widgets.courses';
}
/**
* Get the widget data to send to the view
* @return string
*/
protected function data()
{
return ['coursesCount' => $this->service->countActive()];
}
/**
* Get the widget type
* @return string
*/
protected function options()
{
return [
'width' => '3',
'height' => '1',
'x' => '0',
];
}
}