syntax error, unexpected identifier "Stat", expecting "function" or "const"
I am trying to make a widget on my materials resource page that shows the total number of materials in the table. I am unsure why it is not expecting
7 Replies
You put it outside of a method
So the statement
Stat::
is in a place where no statements are allowed.Have another look at the Docs. It belongs inside a
getStats()
method.
https://filamentphp.com/docs/3.x/widgets/stats-overviewThank you for that it has worked, however my widget is still not showing up on the resoruce page. I think i have registed it corrently and put it in the geader section. Here is the code from the resource.
getHeaderWidgets()
belongs on the Page class. Like EditMaterials
or ListMaterials
This is the page class and the error
Did you generate the widget via CLI?
Search for the view file. The error is pretty self explanatory
I didn’t say you should move
getWidgets()
method. Only getHeaderWidgets()
Yes I generated via the CLI
I read the error see all the parts and get them individually but I'm struggling to parse that into what I need to do