Projekt

Obecné

Profil

Stáhnout (655 Bajtů) Statistiky
| Větev: | Tag: | Revize:
1 e765fd91 Marek Lovčí
<?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 b323292b Marek Lovčí
    const ORDER_COLUMN = 'page';
13
14 e765fd91 Marek Lovčí
    public function __construct()
15
    {
16
        $this->middleware('auth');
17
    }
18
19
    public function index()
20
    {
21 b323292b Marek Lovčí
        $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 e765fd91 Marek Lovčí
27
        return view('favmetadata.index', ['metadata' => $metadata]);
28
    }
29
30
}