dimanche 31 mai 2020

Laravel taking time to loop through 100000 records in blade?

I am trying to loop through 100000 records in select tag but it is taking about one minute to load whole page. I tried to chunk method but it is also taking long time. what should i do?

Controller

public function create()
{
    $addresses = Address::where('status', 1)->get();

    return view('web.pages.transports.consignments.create', compact('addresses'));
}

Blade

<div id="pickup_address" style=" max-width: 100%;">

    <label class="form-control-label">Pickup Address</label>
    <select class="form-control kt-selectpicker " name="pickup_address" id="pickup_address_id" data-live-search="true" required>
        <option value="">Select Address</option>
        @foreach($addresses as $address)

            <option class="wrapword" value="">, , ,, , , </option>
        @endforeach
    </select>
</div>


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire