private function save(Concert $concert, array $inputs)
 {
     $concert->name_artist = $input('name_artist');
     $concert->place = $input('place');
     $concert->address = $input('address');
     $concert->city = $input('city');
     $concert->dateTime = $input('date');
     $concert->price = $input('price');
     $concert->save();
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     Concert::destroy($id);
     return redirect('/login');
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show(Request $request)
 {
     $id_concert = (int) $request->get('concert');
     $id_artiste = (int) $request->get('artiste');
     $concert = Concert::find($id_concert);
     $artiste = Artiste::find($id_artiste);
     return view('homepage.detail-concert', ['concert' => $concert, 'artiste' => $artiste]);
 }
Beispiel #4
0
    public function filter(Request $request)
    {
        //$input = $request->all();
        $filter = false;
        $concerts = Concert::begin();
        $input = Input::except('sid');
        if (Input::has('ville')) {
            $ville = Input::get('ville');
            $concerts = $concerts->ville($ville);
            Session::put('ville', $concerts);
            $filter = true;
        } else {
            Session::forget('ville');
        }
        if (Input::has('prix')) {
            $prix = Input::get('prix');
            $concerts = $concerts->prix($prix);
            Session::put('prix', $concerts);
            $filter = true;
        } else {
            Session::forget('prix');
        }
        if (Input::has('tags')) {
            $tags = Input::get('tags');
            $concerts = $concerts->tags($tags);
            Session::put('tags', $concerts);
            $filter = true;
        } else {
            Session::forget('tags');
        }
        if (Input::has('dateDeb')) {
            $dateDeb = Input::get('dateDeb');
            $concerts = $concerts->dateDeb($dateDeb);
            Session::put('dateDeb', $concerts);
            $filter = true;
        } else {
            Session::forget('dateDeb');
        }
        if (Input::has('dateFin')) {
            $dateFin = Input::get('dateFin');
            $concerts = $concerts->dateFin($dateFin);
            Session::put('dateFin', $concerts);
            $filter = true;
        } else {
            Session::forget('dateFin');
        }
        //dd($input);//dd(gettype($ville) . $ville);
        // $concerts = Concert::paginate(8, ['*'], 'page', $paginaId);
        Session::put('dataConcert', $concerts);
        $paginaId = $request->input('page');
        if ($filter) {
            $temp = $concerts;
            $concerts = $concerts->paginate(9, ['*'], 'page', $paginaId);
            if ($paginaId > $concerts->lastpage()) {
                $concerts = $temp->paginate(9, ['*'], 'page', 1);
            }
            $concerts->setPath('/');
        } else {
            $concerts = Concert::paginate(9, ['*'], 'page', $paginaId)->setPath('/');
        }
        $reponse = '<div class="row">';
        foreach ($concerts as $concert) {
            $reponse .= <<<cc
            <div class="col-xs-4 concert-content container">
        <h5><b> {$concert->artiste->Nom} </b> <span style="float:right">@  {$concert->Lieu} -  {$concert->Ville} <span></h5>
        <a href="/concert/{$concert->id}">
                    <img src="/assets/images/{$concert->artiste->Image}" class="img-rounded" height="250" width="100%">
                </a>
        <br>
        <div class="col-xs-8">
            {$concert->Date} 
        </div>
        <div class="col-xs-4">
            Prix: {$concert->Prix} 
        </div>
        <br>
        <div class="col-xs-8">
            <i>{$concert->artiste->Tags}</i>
        </div>
        <div class="col-xs-4">
            <a href="/concert/{$concert->id}">Voir le détails ></a>
        </div>
    </div>
cc;
        }
        $reponse .= <<<cc
        </div>
        <div class="container-fluid">
            <center>
                {$concerts->render()}
            </center>
        </div>
cc;
        return $reponse;
    }
 public function getPage(Request $request, $pageIndex)
 {
     $city = $request->input('city');
     $tags = $request->input('tags');
     $price = $request->input('price');
     $matchThese = array();
     if ($city != 'unspecified') {
         $matchThese['ville'] = $city;
     }
     if ($price != 'unspecified') {
         $matchThese['prix'] = $price;
     }
     $concertsQueryBuilder = Concert::orderBy('concerts.created_at', 'asc');
     if ($tags != 'unspecified') {
         $matchThese['tags'] = $tags;
         $concertsQueryBuilder->join('artists', 'artists.id', '=', 'concerts.artist_id');
     }
     $concertsQueryBuilder->where($matchThese);
     $concerts = $concertsQueryBuilder->get();
     $villes = array();
     $tags = array();
     $prix = array();
     foreach ($concerts as $concert) {
         if (!in_array($concert->ville, $villes)) {
             $villes[] = $concert->ville;
         }
         if (!in_array($concert->prix, $prix)) {
             $prix[] = $concert->prix;
         }
         if (!in_array($concert->artist->tags, $tags)) {
             $tags[] = $concert->artist->tags;
         }
     }
     $current_page = $pageIndex - 1;
     $concert_count = count($concerts);
     $page_count = $concert_count % SELF::CONCERTS_PER_PAGE != 0 ? floor($concert_count / SELF::CONCERTS_PER_PAGE) + 1 : floor($concert_count / SELF::CONCERTS_PER_PAGE);
     return view('concert_list', ['concerts' => $concerts, 'villes' => $villes, 'tags' => $tags, 'prix' => $prix, 'page_count' => $page_count, 'current_page' => $current_page]);
 }
Beispiel #6
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy(Request $request, $id)
 {
     Concert::destroy($id);
 }