Laravel Nova loading time optimization

Viewed 172

I use Laravel Nova to manage an online shop selling courses. As so, my App/Nova/Course resource is very big and contains a lot of dependencies.

I am currently trying to associate a Course in a Step (when the user complete a Step, they win a badge), using a MorphedByMany field (a Step can contain either Course or Quizz).

public function fields(Request $request)
{
    return [
        ID::make()->sortable(),

        Text::make('Label')
            ->required()
            ->sortable(),

        MorphedByMany::make('Courses')->fields(function () {
            return [
                Number::make('Awarded points', 'awarded_points')
                    ->sortable()
                    ->required(),
            ];
        }),
    ];
}

My problem is that the Course select in the Laravel Nova form take a long time to load due to App/Nova/Course complexity.

Is there a way to reduce this loading time?

0 Answers
Related