| 1 | <?php namespace Modules\Blog\Widgets; |
||
| 7 | class LatestPostsWidget extends BaseWidget |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var PostRepository |
||
| 11 | */ |
||
| 12 | private $post; |
||
| 13 | |||
| 14 | public function __construct(PostRepository $post, Setting $setting) |
||
| 15 | { |
||
| 16 | $this->post = $post; |
||
| 17 | $this->setting = $setting; |
||
| 18 | } |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Get the widget name |
||
| 22 | * @return string |
||
| 23 | */ |
||
| 24 | protected function name() |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Get the widget options |
||
| 31 | * Possible options: |
||
| 32 | * x, y, width, height |
||
| 33 | * @return string |
||
| 34 | */ |
||
| 35 | protected function options() |
||
| 36 | { |
||
| 37 | return [ |
||
| 38 | 'width' => '4', |
||
| 39 | 'height' => '4', |
||
| 40 | ]; |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Get the widget view |
||
| 45 | * @return string |
||
| 46 | */ |
||
| 47 | protected function view() |
||
| 51 | |||
| 52 | /** |
||
| 53 | * Get the widget data to send to the view |
||
| 54 | * @return string |
||
| 55 | */ |
||
| 56 | protected function data() |
||
| 62 | } |
||
| 63 |