1
|
<?php
|
2
|
|
3
|
namespace App\Http\Controllers;
|
4
|
|
5
|
use App\ArtefactUser;
|
6
|
use Illuminate\Http\Request;
|
7
|
use App\Metadata;
|
8
|
use App\Artefact;
|
9
|
|
10
|
class DetailsController extends Controller
|
11
|
{
|
12
|
public function __construct()
|
13
|
{
|
14
|
$this->middleware('auth');
|
15
|
}
|
16
|
|
17
|
/**
|
18
|
* Display a listing of the resource.
|
19
|
*
|
20
|
* @return \Illuminate\Http\Response
|
21
|
*/
|
22
|
public function index()
|
23
|
{
|
24
|
$data = array(
|
25
|
'title' => 'Welcome to the MERLOT page',
|
26
|
);
|
27
|
//return view('index', compact('title'));
|
28
|
return view('index') -> with($data);
|
29
|
}
|
30
|
|
31
|
/**
|
32
|
* Display the specified resource.
|
33
|
*
|
34
|
* @param int $id
|
35
|
* @return \Illuminate\Http\Response
|
36
|
*/
|
37
|
public function show($id)
|
38
|
{
|
39
|
$data = array(
|
40
|
'id' => $id,
|
41
|
'arrArtefact' => Artefact::find($id),
|
42
|
'likes' => Artefact::find($id)->users()->count(),
|
43
|
'metadata' => Metadata::where('artefact_id', $id)->get()
|
44
|
);
|
45
|
return view('detail.index') -> with($data);
|
46
|
}
|
47
|
|
48
|
}
|