commit 10222730a4d5a9ff7afd38bd4586bafc9137b04a
Author: Adam Mištera <amistera@students.zcu.cz>
Date:   Tue Apr 7 20:06:14 2020 +0200

    Issue #7696 2h
    [+] Vytvoření detailu artefaktu
    [+] Refraktoring, doplnění dokumentace

diff --git a/app/Artefact.php b/app/Artefact.php
index 0b52a4d..f946b93 100644
--- a/app/Artefact.php
+++ b/app/Artefact.php
@@ -7,7 +7,7 @@ use Illuminate\Database\Eloquent\Model;
 class Artefact extends Model
 {
     // Table Name
-    protected $table = 'artafacts';//unnecessery?
+    protected $table = 'artefacts';//unnecessery?
     // Primary Key
     public $primaryKey = 'id';//unnecessery?
 
diff --git a/app/Http/Controllers/ArtefactController.php b/app/Http/Controllers/ArtefactController.php
index 10535fe..14ee651 100644
--- a/app/Http/Controllers/ArtefactController.php
+++ b/app/Http/Controllers/ArtefactController.php
@@ -8,10 +8,28 @@ use Illuminate\Support\Facades\DB;
 
 class ArtefactController extends Controller
 {
+    /**
+     * Returns view of all artefacts.
+     *
+     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
+     */
     public function default()
     {
-        $artefacts = DB::table('artefacts')->get();
+        $artefacts = Artefact::all();
 
         return view('artefact.default', ['artefacts' => $artefacts]);
     }
+
+    /**
+     * Returns view of single artefact given by its id.
+     *
+     * @param $id int id of the artefact
+     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
+     */
+    public function view($id)
+    {
+        $artefact = Artefact::find($id);
+
+        return view('artefact.view', ['artefact' => $artefact]);
+    }
 }
diff --git a/app/Metadata.php b/app/Metadata.php
index ee2a148..6dd1774 100644
--- a/app/Metadata.php
+++ b/app/Metadata.php
@@ -28,7 +28,7 @@ class Metadata extends Model
     public $timestamps = false;
 
     /**
-     * Get the artafact for this single metadata.
+     * Get the artefact for this single metadata.
      */
     public function artefact(){
         return $this->belongsTo('App\Artefact');
diff --git a/resources/views/artefact/default.blade.php b/resources/views/artefact/default.blade.php
index 09a349b..f7312d7 100644
--- a/resources/views/artefact/default.blade.php
+++ b/resources/views/artefact/default.blade.php
@@ -1,4 +1,4 @@
-@extends('layouts.master')
+@extends('layouts.app')
 
 @section('title', 'Artefacts')
 
@@ -29,7 +29,7 @@
         </div>
     @else
         @foreach ($artefacts as $artefact)
-            <div class="artefact-area mb-5">
+            <div class="artefacts-area mb-5">
                 <div class="card">
                     <svg class="bd-placeholder-img card-img-top" width="100%" height="180" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" focusable="false" role="img" aria-label="Placeholder: Image cap"><title>Placeholder</title><rect width="100%" height="100%" fill="#868e96"></rect><text x="45%" y="50%" fill="#dee2e6" dy=".3em">Artefact image</text></svg>
                     <div class="card-body">
diff --git a/resources/views/artefact/view.blade.php b/resources/views/artefact/view.blade.php
new file mode 100644
index 0000000..4b06732
--- /dev/null
+++ b/resources/views/artefact/view.blade.php
@@ -0,0 +1,58 @@
+@extends('layouts.app')
+
+@section('title', 'Artefacts')
+
+@section('breadcrumb')
+    <li class="breadcrumb-item"><a href="{{ URL::to('/') }}">Home</a></li>
+    <li class="breadcrumb-item" aria-current="page"><a href="{{ URL::to('/artefact') }}">Artefacts</a></li>
+    <li class="breadcrumb-item active" aria-current="page">Detail</li>
+@endsection
+
+
+@section('content')
+    <div class="jumbotron">
+        <div class="text-center">
+            <h1>Artefact</h1>
+            <p>
+                Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
+                Mauris dolor felis, sagittis at, luctus sed, aliquam non, tellus.
+                Fusce tellus odio, dapibus id fermentum quis, suscipit id erat.
+                Morbi scelerisque luctus velit. Vivamus porttitor turpis ac leo.
+                Morbi scelerisque luctus velit.
+                Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
+            </p>
+        </div>
+    </div>
+
+    @if (is_null($artefact))
+        <div class="text-center">
+            <h2>Currently no artefacts available.</h2>
+        </div>
+    @else
+        <div class="artefact-area mb-5">
+            <div class="card">
+                <div class="card-body">
+                    <h2 class="text-uppercase card-title">{{$artefact->name}}</h2>
+                    <h5>{{$artefact->author}}</h5>
+                    <h6 class="card-subtitle mb-2 text-muted">{{$artefact->year}}, {{$artefact->pages}} pages</h6>
+                    <p class="card-text">
+                        Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
+                        Mauris dolor felis, sagittis at, luctus sed, aliquam non, tellus.
+                        Fusce tellus odio, dapibus id fermentum quis, suscipit id erat.
+                        Morbi scelerisque luctus velit. Vivamus porttitor turpis ac leo.
+                        Morbi scelerisque luctus velit.
+                        Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
+                    </p>
+                    <p>
+                        @if (!is_null($artefact->metadata))
+                            <a href="{{ url('/detail/' . $artefact->id) }}">Notes related to artefact</a>
+                        @endif
+                    </p>
+                </div>
+            </div>
+        </div>
+    @endif
+
+
+
+@endsection
diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php
new file mode 100644
index 0000000..f3b2a30
--- /dev/null
+++ b/resources/views/layouts/app.blade.php
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html lang="{{ config('app.locale', 'en') }}">
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+
+    <title>{{ config('app.name', 'Dev') }} - @yield('title')</title>
+
+    <!-- CSS styles -->
+    <link href="{{ asset('css/app.css') }}" rel="stylesheet" type="text/css">
+</head>
+<body>
+        <nav aria-label="breadcrumb">
+            <ol class="breadcrumb">
+               @yield('breadcrumb')
+            </ol>
+        </nav>
+
+    <div class="container">
+        <div class="content">
+            @yield('content')
+        </div>
+
+        <hr>
+        <footer class="container">
+            © 2020
+        </footer>
+    </div>
+</body>
+</html>
diff --git a/resources/views/layouts/master.blade.php b/resources/views/layouts/master.blade.php
deleted file mode 100644
index f3b2a30..0000000
--- a/resources/views/layouts/master.blade.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE html>
-<html lang="{{ config('app.locale', 'en') }}">
-<head>
-    <meta charset="utf-8">
-    <meta name="viewport" content="width=device-width, initial-scale=1">
-
-    <title>{{ config('app.name', 'Dev') }} - @yield('title')</title>
-
-    <!-- CSS styles -->
-    <link href="{{ asset('css/app.css') }}" rel="stylesheet" type="text/css">
-</head>
-<body>
-        <nav aria-label="breadcrumb">
-            <ol class="breadcrumb">
-               @yield('breadcrumb')
-            </ol>
-        </nav>
-
-    <div class="container">
-        <div class="content">
-            @yield('content')
-        </div>
-
-        <hr>
-        <footer class="container">
-            © 2020
-        </footer>
-    </div>
-</body>
-</html>
diff --git a/resources/views/pages/index.blade.php b/resources/views/pages/index.blade.php
index c3ad5ce..9f08f15 100644
--- a/resources/views/pages/index.blade.php
+++ b/resources/views/pages/index.blade.php
@@ -1,4 +1,4 @@
-@extends('layouts.master')
+@extends('layouts.app')
 
 @section('title', 'Homepage')
 
diff --git a/routes/web.php b/routes/web.php
index 897b620..bc2aadf 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -16,3 +16,5 @@ use Illuminate\Support\Facades\Route;
 Route::get('/', 'PagesController@index');
 
 Route::get('/artefact', 'ArtefactController@default');
+
+Route::get('/artefact/{id}', 'ArtefactController@view');
