Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 4c56c41b

Přidáno uživatelem Marek Zábran před asi 4 roky(ů)

Oprava pro jednotlivé artefakty v charts.

Zobrazit rozdíly:

app/Http/Controllers/ArtefactController.php
117 117
     * @param $id int id of the artefact
118 118
     * @return Factory|View
119 119
     */
120
    /*public function view($id)
120
    public function view($id)
121 121
    {
122
        $artefact = Artefact::find($id)->simplePaginate(1);
122
        $artefact = Artefact::where('id', $id)->simplePaginate(1);
123 123
        $artefact = $this->prepData($artefact);
124 124
        //return view('artefact.view', ['artefact' => $artefact]);
125 125
        return view('artefact.default', ['artefacts' => $artefact]);
126
    }*/
126
    }
127 127

  
128 128
    /**
129 129
     * Likes artefact given by its id.
......
163 163
     * @param $id int id of artefact
164 164
     * @return RedirectResponse
165 165
     */
166
    public function view($id)
166
    /*public function view($id)
167 167
    {
168 168
        //$user = User::find(Auth::id());
169 169
        //$artefact = Artefact::find($id);
170 170

  
171 171
        $artefacts = Artefact::withCount('users')->orderByDesc('users_count')->get()->take(10);
172 172

  
173
        $currentPage = -1; // You can set this to any page you want to paginate to
174 173

  
175
        for($i=0;$i<10;$i++){
176
            if($artefacts[$i]->id==$id) $currentPage = $i+1;
177
        }
174
            $currentPage = -1; // You can set this to any page you want to paginate to
175

  
176
            for($i=0;$i<10;$i++){
177
                if($artefacts[$i]->id==$id) $currentPage = $i+1;
178
            }
179
            // Make sure that you call the static method currentPageResolver()
180
            // before querying users
181
            \Illuminate\Pagination\Paginator::currentPageResolver(function () use ($currentPage) {
182
                return $currentPage;
183
            });
184

  
178 185

  
179
        // Make sure that you call the static method currentPageResolver()
180
        // before querying users
181
        \Illuminate\Pagination\Paginator::currentPageResolver(function () use ($currentPage) {
182
            return $currentPage;
183
        });
184 186

  
185 187
        $artefacts = Artefact::withCount('users')->orderByDesc('users_count')->limit(10)->paginate(1);
186 188

  
......
195 197

  
196 198

  
197 199
        //return back()->withInput();
198
    }
200
    /*}*/
199 201
}

Také k dispozici: Unified diff