“Laravel de carga perezosa” Código de respuesta

Wherehas Sitio: https: //laravel.com/docs/

use Illuminate\Database\Eloquent\Builder;

// Retrieve posts with at least one comment containing words like code%...
$posts = Post::whereHas('comments', function (Builder $query) {
    $query->where('content', 'like', 'code%');
})->get();

// Retrieve posts with at least ten comments containing words like code%...
$posts = Post::whereHas('comments', function (Builder $query) {
    $query->where('content', 'like', 'code%');
}, '>=', 10)->get();
Tiago F2

Laravel de carga perezosa

   $(document).ready(function () {
        $("img.lazy").showLazyLoad();
    });

    var pageLazyLoad = 1;
    $(window).scroll(function () {
        if ($(window).scrollTop() + $(window).height() >= $(document).height() - 100) {
            pageLazyLoad++;
            loadMoreData(pageLazyLoad);
        }
    });

    $.fn.showLazyLoad = function () {
        this.lazyload({
            effect: "fadeIn",
            threshold: 2.05,
        });
    };
Zany Zebra

Carga perezosa frente a la carga ansiosa Laravel

1. Eager Loading : Eager Loading helps you to load all your needed entities at once.
  i.e. related objects (child objects) are loaded automatically with its parent 
 object. Use Eager Loading when the relations are not too much. Thus, 
Eager Loading is a good practice to reduce further queries on the Server.
Use Eager Loading when you are sure that you will be using related entities with the main entity everywhere.
Lazy Loading: In case of lazy loading, related objects (child objects) are not loaded automatically with its parent object until they are requested. By default LINQ supports lazy loading.


M. Wasim Abbasi

Respuestas similares a “Laravel de carga perezosa”

Preguntas similares a “Laravel de carga perezosa”

Más respuestas relacionadas con “Laravel de carga perezosa” en PHP

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código