Beispiel #1
0
 public function getAnnonceById($id)
 {
     $annonce = Annonce::select('id', 'titre', 'prix', 'date_online', 'ville', 'descriptif', 'mail_a', 'tel_a')->where('status', '=', 2)->where('id', '=', $id)->get();
     if (!empty($annonce[0])) {
         $template = $this->app->getContainer()->get('twig')->loadTemplate('announce.html');
         return $template->render(array('annonce' => $annonce));
     } else {
         $template = $this->app->getContainer()->get('twig')->loadTemplate('error.html');
         $tab = ['titre' => 'Erreur', 'message' => 'Annonce inexistante ou non valide.'];
         return $template->render(array('error' => $tab));
     }
 }
Beispiel #2
0
 public function getAnnonceur($id)
 {
     $query = Annonce::select('ville', 'code_postal', 'nom_a', 'prenom_a', 'mail_a', 'tel_a')->where('id', '=', $id);
     $annonceur = $query->get();
     return $this->jsonResponse($annonceur, 200);
 }