1
|
<?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
|
public function __construct()
|
12
|
{
|
13
|
$this->middleware('auth');
|
14
|
}
|
15
|
|
16
|
/**
|
17
|
* Returns view of all artefacts.
|
18
|
*
|
19
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
20
|
*/
|
21
|
public function default()
|
22
|
{
|
23
|
$artefacts = Artefact::all();
|
24
|
|
25
|
return view('artefact.default', ['artefacts' => $artefacts]);
|
26
|
}
|
27
|
|
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
|
}
|