Skip to content
Snippets Groups Projects
Verified Commit dadc3c42 authored by CARLIER Maxime's avatar CARLIER Maxime
Browse files

Refactoring Index Controller for Improved Clarity and Query Optimization

parent 3ccb2ab5
No related branches found
No related tags found
No related merge requests found
......@@ -22,7 +22,8 @@ class indexController
public function getAll($chemin)
{
$annonces = Annonce::with("Annonceur")->orderBy('id_annonce', 'desc')->take(12)->get()->map(function ($annonce) use ($chemin) {
$annonces = Annonce::with("Annonceur")->orderBy('id_annonce', 'desc')->take(12)->get()
->map(function ($annonce) use ($chemin) {
$annonce->nb_photo = Photo::where("id_annonce", "=", $annonce->id_annonce)->count();
$annonce->url_photo = $annonce->nb_photo > 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment