Projekt

Obecné

Profil

Stáhnout (655 Bajtů) Statistiky
| Větev: | Tag: | Revize:
1 09795926 Adam Mištera
<?php
2
3
namespace App\Http\Controllers;
4
5
use App\Metadata;
6
use App\User;
7
use Illuminate\Http\Request;
8
use Illuminate\Support\Facades\Auth;
9
10
class FavoriteMetadataController extends Controller
11
{
12 3c062db9 Adam Mištera
    const ORDER_COLUMN = 'page';
13
14 09795926 Adam Mištera
    public function __construct()
15
    {
16
        $this->middleware('auth');
17
    }
18
19
    public function index()
20
    {
21 3c062db9 Adam Mištera
        $metadata = User::find(Auth::id())->likesMetadata()->orderBy(self::ORDER_COLUMN)->get();
22
        foreach($metadata as $item)
23
        {
24
            $item['artefact'] = Metadata::find($item->id)->artefact()->first();
25
        }
26 09795926 Adam Mištera
27
        return view('favmetadata.index', ['metadata' => $metadata]);
28
    }
29
30
}