Eager load or lazy load on modals?

Sorry for the silly question. I have an Edit modal for a record on my table. I am using $record->supplier in multiple places ( supplier being a relationship which gets the supplier modal for the table record ). Is a query being run each time to get the supplier info or is it eager loaded the once? Thanks all. I am running $record->supplier maybe five times through the schema so I idealy I didnt want to be running a query five times for the same thing. Example code usage:
TextInput::make('total')->prefix('£')->required()->numeric()
->live()->debounce()
->afterStateUpdated(fn (Set $set, Get $get, $state, $record) => self::totalsCalc($set, $get, $state, $record->supplier, 'total')),
TextInput::make('total')->prefix('£')->required()->numeric()
->live()->debounce()
->afterStateUpdated(fn (Set $set, Get $get, $state, $record) => self::totalsCalc($set, $get, $state, $record->supplier, 'total')),
2 Replies
Dennis Koch
Dennis Koch3mo ago
I guess it's the same model that's passed around so it's only loaded once? Check with Debugbar
David | Fortune Validator
I’ll try that out thank you Yeah it’s the same record. Being loaded so hopefully it’s just the once
Want results from more Discord servers?
Add your server