getUrl() Method not working on Model

Good morning. Hoping someone might have some insight, I can't find a clear answer with search. I'm trying to pre-fill a Placeholder with a link to another model's view resource, but I'm getting an error that I can't use my Organizations::getUrl() method. Forms\Components\Placeholder::make('Company Link') ->hidden(fn (Get $get) => $get('organization_id') == '') ->label('Company Link') ->content(function (Opportunities $record): string { $organization = Organizations::find($record->organization_id); // get a URL to the record view page return Organizations::getUrl('edit', ['record' => $organization]); }) Error: Call to undefined method App\Models\Organizations::getUrl() I just updated to the latest version (v3.2.81) and the issue persists. Organizations is already used on this form for a select without issue, it's just the getUrl() method that's not working.
3 Replies
Dennis Koch
Dennis Koch8mo ago
Good morning. Please read #✅┊rules
toeknee
toeknee8mo ago
Because you need to call the resource not the model.
WessBechard
WessBechardOP8mo ago
Oh wow, that's a giant face-palm. Thanks. Obviously OrganizationsResource::getUrl() is working 🙂
Want results from more Discord servers?
Add your server