-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Laravel Debugbar show duplicate queries
In the CanPaginateViewRecord trait, $this->getPreviousRecord() and $this->getNextRecord() fired two times
may be store as a variable in the if statement to reduce the method fired again.
protected function configurePreviousAction(Action $action): void
{
// Here store as a variable the previous record
if ($previousRecord = $this->getPreviousRecord()) {
$action->url(fn (): string => static::getResource()::getUrl(static::getResourcePageName(), ['record' => $previousRecord]));
} else {
$action
->disabled()
->color('gray');
}
}
protected function configureNextAction(Action $action): void
{
// Here store as a variable the next record
if ($nextRecord = $this->getNextRecord()) {
$action->url(fn (): string => static::getResource()::getUrl(static::getResourcePageName(), ['record' => $nextRecord]));
} else {
$action
->disabled()
->color('gray');
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels