stars() table()
Show a rating as a row of star icons.
table()->stars($name, $desc = '', $extra = [])Options
| Option | Meaning |
|---|---|
stars | Number of stars; default 5. |
max | Value of a full row; default 5 (['stars' => 5, 'max' => 100] for a percent). |
color_ok, color_ko | Colours of lit and dim stars; default yellow and none. |
class, class_ok, class_ko | Icon class (CLASS_ICON_STAR) and the classes of lit and dim stars. |
Example
| Name | Rating | Score |
|---|---|---|
| Desk lamp | ||
| Office chair |
Code
$rows = [
1 => ['id' => 1, 'name' => 'Desk lamp', 'rating' => 4, 'score' => 35],
2 => ['id' => 2, 'name' => 'Office chair', 'rating' => 2, 'score' => 90],
];
return table($rows, ['no_pages' => 1])
->text('name')
->stars('rating')
->stars('score', ['stars' => 5, 'max' => 100, 'color_ko' => '#ccc']);See also: form/stars, demo:table/form