recettes->list', routeAction: 'list', routeMethods: ['POST'] ), ]; } public function list(){ $title = Request::post( 'title' ) ?? ""; $tagsId = explode( ",", Request::post( 'tagsId' ) ) ?? []; $ingredientsId = explode( ",", Request::post( 'ingredientsId' ) ) ?? []; if( $tagsId == [ "" ] ) $tagsId = []; if( $ingredientsId == [ "" ] ) $ingredientsId = []; $tagsId = array_map( 'intval', $tagsId ); $ingredientsId = array_map( 'intval', $ingredientsId ); $recetteRepo = new RecetteRepository(); $resp = $recetteRepo->advancedRecetteSearch( $title, $tagsId, $ingredientsId ); $resp = array_map( function($recette) use ($recetteRepo){ return $recetteRepo->getByID( $recette['num_recette'] ); }, $resp ?? [] ); JSONResponse::sendSuccess( [ 'data' => $resp ] ); } }