Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 2fee1bb5

Přidáno uživatelem Marek Lovčí před asi 4 roky(ů)

Language mutations and code clean

Zobrazit rozdíly:

app/Http/Controllers/ArtefactController.php
4 4

  
5 5
use App\Artefact;
6 6
use App\ArtefactCategory;
7
use App\Category;
8
use App\Metadata;
9 7
use App\User;
10
use Illuminate\Http\Request;
8
use Illuminate\Contracts\View\Factory;
9
use Illuminate\Http\RedirectResponse;
11 10
use Illuminate\Support\Facades\Auth;
12
use Illuminate\Support\Facades\DB;
11
use Illuminate\View\View;
13 12

  
14 13
class ArtefactController extends Controller
15 14
{
......
21 20
    /**
22 21
     * Returns view of all artefacts.
23 22
     *
24
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
23
     * @return Factory|View
25 24
     */
26 25
    public function default()
27 26
    {
......
33 32
    /**
34 33
     * Returns view of artefacts related to the chosen category
35 34
     *
36
     * @param $id       id of the category
37
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
35
     * @param $id id of the category
36
     * @return Factory|View
38 37
     */
39 38
    public function showCategory($id)
40 39
    {
41
        $cateogryArtefacts = ArtefactCategory::where('category_id', $id)->get();
42
        if(count($cateogryArtefacts) > 0)
40
        $categoryArtefacts = ArtefactCategory::where('category_id', $id)->get();
41
        if(count($categoryArtefacts) > 0)
43 42
        {
44 43
            $artefacts = array();
45
            foreach($cateogryArtefacts as $ar)
44
            foreach($categoryArtefacts as $ar)
46 45
            {
47 46
                array_push($artefacts, Artefact::where('id', $ar->artefact_id)->get());
48 47
            }
......
58 57
     * Returns view of single artefact given by its id.
59 58
     *
60 59
     * @param $id int id of the artefact
61
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
60
     * @return Factory|View
62 61
     */
63 62
    public function view($id)
64 63
    {
......
73 72
     * Likes artefact given by its id.
74 73
     *
75 74
     * @param $id int id of metadata
76
     * @return \Illuminate\Http\RedirectResponse
75
     * @return RedirectResponse
77 76
     */
78 77
    public function like($id)
79 78
    {
......
89 88
     * Unlikes artefact given by its id.
90 89
     *
91 90
     * @param $id int id of metadata
92
     * @return \Illuminate\Http\RedirectResponse
91
     * @return RedirectResponse
93 92
     */
94 93
    public function unlike($id)
95 94
    {

Také k dispozici: Unified diff