Widgets
Go to App\Http\Controllers\Hoggar\Dashboard\DashboardController and create a props named
'widget1'.
public function index(Request $request)
{
return Inertia::render('HoggarPages/Dashboard/Dashboard', [
/* ... */
'widget1' => [
'value' => mt_rand(1, 50),
'title' => 'Sales of month',
'icon' => 'account_circle'
],
/* ... */
]);
}
In resources\js\Pages\HoggarPages\Dashboard\Dashboard.vue in setup.
const props = defineProps({
/* ... */
widget1: {
type: Object,
required: true
},
/* ... */
});
In resources\js\Pages\HoggarPages\Dashboard\Dashboard.vue in the template.
<Widget
:Myprops=props.widget1
:NameWidget='widget1'
/>