code16/sharp
Code-driven CMS framework for Laravel (PHP 8.3+/Laravel 11+). Build admin/CMS sections with a clean UI and strong DX: CRUD with validation, search/sort/filter, bulk or custom commands, and authorization—no front-end code required, data-agnostic.
This widget is intended to display any useful information to the user, based on a custom blade template.
$widgetsContainer->addWidget(
SharpPanelWidget::make('messages')
->setTemplate('my/blade/template')
The Panel needs a blade template to be rendered:
setTemplate(View|string $template)Pass a blade view path, or a blade content.
Valuation is handled by a dedicated $this->setPanelData(string $panelWidgetKey, array $data) in the Dashboard class.
Example:
class MyDashboard extends SharpDashboard
{
// ...
protected function buildWidgets(WidgetsContainer $widgetsContainer): void
{
$widgetsContainer
->addWidget(
SharpPanelWidget::make('my_panel')
->setTitle('My custom panel')
->setTemplate(view('sharp.templates.dashboard_panel')) // Must be an existing blade view
);
}
public function buildWidgetsData(): void
{
// ...
$this->setPanelData('my_panel', [
// Add here every data required by the blade template
'author' => $author,
'post_count' => $count,
]);
}
}
How can I help you explore Laravel packages today?