© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
2 replies
padioca

Accessing Model /ResourceIn Widget

I know this has been asked a lot, and I have done a lot of searching trying to figure this out but for some reason I cannot access the Model when I am on a View Page. I have tried:
use Illuminate\Database\Eloquent\Model;
 
public ?Model $record = null;
use Illuminate\Database\Eloquent\Model;
 
public ?Model $record = null;

to no avail. It always responds with an error saying 'Attempt to read property "name" on null'. If I remove the
= null
= null
portion I get an error saying I can't access the variable before it is initialized. I have created a very basic widget using the CLI and run into the same issues even when starting from scratch.
Could really use some help here, I am stumped at this point.
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Accessing the resource/model inside Stats Overview widget
FilamentFFilament / ❓┊help
2y ago
Send Model to widget
FilamentFFilament / ❓┊help
2y ago
Problem in accessing widget current record
FilamentFFilament / ❓┊help
2y ago
Get Model id on Widget
FilamentFFilament / ❓┊help
2y ago