1 |
74e290c2
|
Adam Mištera
|
<?php
|
2 |
|
|
|
3 |
|
|
namespace App\Http\Controllers;
|
4 |
|
|
|
5 |
|
|
use App\Artefact;
|
6 |
|
|
use Illuminate\Http\Request;
|
7 |
|
|
use Illuminate\Support\Facades\DB;
|
8 |
|
|
|
9 |
|
|
class ArtefactController extends Controller
|
10 |
|
|
{
|
11 |
21570473
|
Adam Mištera
|
public function __construct()
|
12 |
|
|
{
|
13 |
|
|
$this->middleware('auth');
|
14 |
|
|
}
|
15 |
|
|
|
16 |
10222730
|
Adam Mištera
|
/**
|
17 |
|
|
* Returns view of all artefacts.
|
18 |
|
|
*
|
19 |
|
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
20 |
|
|
*/
|
21 |
74e290c2
|
Adam Mištera
|
public function default()
|
22 |
|
|
{
|
23 |
10222730
|
Adam Mištera
|
$artefacts = Artefact::all();
|
24 |
74e290c2
|
Adam Mištera
|
|
25 |
|
|
return view('artefact.default', ['artefacts' => $artefacts]);
|
26 |
|
|
}
|
27 |
10222730
|
Adam Mištera
|
|
28 |
|
|
/**
|
29 |
|
|
* Returns view of single artefact given by its id.
|
30 |
|
|
*
|
31 |
|
|
* @param $id int id of the artefact
|
32 |
|
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
33 |
|
|
*/
|
34 |
|
|
public function view($id)
|
35 |
|
|
{
|
36 |
|
|
$artefact = Artefact::find($id);
|
37 |
|
|
|
38 |
|
|
return view('artefact.view', ['artefact' => $artefact]);
|
39 |
|
|
}
|
40 |
74e290c2
|
Adam Mištera
|
}
|