Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
webbingbrasil/courses-module / Widgets / CourseWidget.php
Size: Mime:
<?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',
        ];
    }
}