“Chargement paresseux Laravel” Réponses codées

WHAME SITE: 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

Chargement paresseux Laravel

   $(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

Chargement paresseux vs chargement avide 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

Réponses similaires à “Chargement paresseux Laravel”

Questions similaires à “Chargement paresseux Laravel”

Plus de réponses similaires à “Chargement paresseux Laravel” dans PHP

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code