Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
1 / 1 |
| BrandSlider | |
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
5 | |
100.00% |
1 / 1 |
| label | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
| icon | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| description | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| fields | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| brands | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | namespace App\Widgets\Types; |
| 3 | use App\Models\Brand; |
| 4 | use App\Widgets\AbstractWidget; |
| 5 | class BrandSlider extends AbstractWidget { |
| 6 | protected string $view='widgets.brand-slider'; |
| 7 | public function label():string{return 'Brand slider';} public function icon():string{return 'fas fa-copyright';} |
| 8 | public function description():string{return 'A scrollable row of brand logos.';} |
| 9 | public function fields():array{return ['title'=>['type'=>'text','label'=>'Heading','default'=>'Shop by brand'],'limit'=>['type'=>'number','label'=>'How many brands','default'=>12]];} |
| 10 | public function brands(array $s){return Brand::orderBy('name')->limit(max(1,min(30,(int)($s['limit']??12))))->get();} |
| 11 | } |