Projekt

Obecné

Profil

« Předchozí | Další » 

Revize f71bf8bd

Přidáno uživatelem Cajova-Houba před asi 7 roky(ů)

refs #6842: Pridani rozliseni smeru do query pro ziskani zarizeni. Nazvy url parametru presunuty do konstant.

Zobrazit rozdíly:

backend/app/Model/Zarizeni.php
47 47
     * Vrati zarizeni nalezene podle adresy (mesto+ulice).
48 48
     *
49 49
     * @param $address Adresa, jsou vraceny zaznamy u kterych ulice, nebo mesto odpovida adrese.
50
     * @param $showDirection 1 pokud má být rozlišen směr zařízení.
50 51
     * @return mixed
51 52
     */
52
    public static function findByAddressJoinAddress($address) {
53
        return DB::table('zarizeni')
53
    public static function findByAddressJoinAddress($address, $showDirection) {
54
        $query = DB::table('zarizeni')
54 55
            ->join('ulice', 'zarizeni.ulice_id', '=', 'ulice.id')
55 56
            ->join('mesto', 'ulice.mesto_id', '=', 'mesto.id')
56 57
            ->select('zarizeni.id as id',
......
60 61
                'mesto.nazev as town',
61 62
                'mesto.id as town_id')
62 63
            ->where('ulice.nazev', 'like', '%'.$address.'%')
63
            ->orWhere('mesto.nazev', 'like', '%'.$address.'%')
64
            ->get();
64
            ->orWhere('mesto.nazev', 'like', '%'.$address.'%');
65

  
66
        if (!$showDirection) {
67
            $query = $query->groupBy('zarizeni.ulice_id');
68
        }
69

  
70

  
71
        return $query->get();
65 72
    }
66 73

  
67 74
    /**

Také k dispozici: Unified diff