Revize 10222730
Přidáno uživatelem Adam Mištera před téměř 5 roky(ů)
app/Artefact.php | ||
---|---|---|
7 | 7 |
class Artefact extends Model |
8 | 8 |
{ |
9 | 9 |
// Table Name |
10 |
protected $table = 'artafacts';//unnecessery?
|
|
10 |
protected $table = 'artefacts';//unnecessery?
|
|
11 | 11 |
// Primary Key |
12 | 12 |
public $primaryKey = 'id';//unnecessery? |
13 | 13 |
|
app/Http/Controllers/ArtefactController.php | ||
---|---|---|
8 | 8 |
|
9 | 9 |
class ArtefactController extends Controller |
10 | 10 |
{ |
11 |
/** |
|
12 |
* Returns view of all artefacts. |
|
13 |
* |
|
14 |
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
|
15 |
*/ |
|
11 | 16 |
public function default() |
12 | 17 |
{ |
13 |
$artefacts = DB::table('artefacts')->get();
|
|
18 |
$artefacts = Artefact::all();
|
|
14 | 19 |
|
15 | 20 |
return view('artefact.default', ['artefacts' => $artefacts]); |
16 | 21 |
} |
22 |
|
|
23 |
/** |
|
24 |
* Returns view of single artefact given by its id. |
|
25 |
* |
|
26 |
* @param $id int id of the artefact |
|
27 |
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
|
28 |
*/ |
|
29 |
public function view($id) |
|
30 |
{ |
|
31 |
$artefact = Artefact::find($id); |
|
32 |
|
|
33 |
return view('artefact.view', ['artefact' => $artefact]); |
|
34 |
} |
|
17 | 35 |
} |
app/Metadata.php | ||
---|---|---|
28 | 28 |
public $timestamps = false; |
29 | 29 |
|
30 | 30 |
/** |
31 |
* Get the artafact for this single metadata.
|
|
31 |
* Get the artefact for this single metadata.
|
|
32 | 32 |
*/ |
33 | 33 |
public function artefact(){ |
34 | 34 |
return $this->belongsTo('App\Artefact'); |
resources/views/artefact/default.blade.php | ||
---|---|---|
1 |
@extends('layouts.master')
|
|
1 |
@extends('layouts.app')
|
|
2 | 2 |
|
3 | 3 |
@section('title', 'Artefacts') |
4 | 4 |
|
... | ... | |
29 | 29 |
</div> |
30 | 30 |
@else |
31 | 31 |
@foreach ($artefacts as $artefact) |
32 |
<div class="artefact-area mb-5"> |
|
32 |
<div class="artefacts-area mb-5">
|
|
33 | 33 |
<div class="card"> |
34 | 34 |
<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> |
35 | 35 |
<div class="card-body"> |
resources/views/artefact/view.blade.php | ||
---|---|---|
1 |
@extends('layouts.app') |
|
2 |
|
|
3 |
@section('title', 'Artefacts') |
|
4 |
|
|
5 |
@section('breadcrumb') |
|
6 |
<li class="breadcrumb-item"><a href="{{ URL::to('/') }}">Home</a></li> |
|
7 |
<li class="breadcrumb-item" aria-current="page"><a href="{{ URL::to('/artefact') }}">Artefacts</a></li> |
|
8 |
<li class="breadcrumb-item active" aria-current="page">Detail</li> |
|
9 |
@endsection |
|
10 |
|
|
11 |
|
|
12 |
@section('content') |
|
13 |
<div class="jumbotron"> |
|
14 |
<div class="text-center"> |
|
15 |
<h1>Artefact</h1> |
|
16 |
<p> |
|
17 |
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. |
|
18 |
Mauris dolor felis, sagittis at, luctus sed, aliquam non, tellus. |
|
19 |
Fusce tellus odio, dapibus id fermentum quis, suscipit id erat. |
|
20 |
Morbi scelerisque luctus velit. Vivamus porttitor turpis ac leo. |
|
21 |
Morbi scelerisque luctus velit. |
|
22 |
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. |
|
23 |
</p> |
|
24 |
</div> |
|
25 |
</div> |
|
26 |
|
|
27 |
@if (is_null($artefact)) |
|
28 |
<div class="text-center"> |
|
29 |
<h2>Currently no artefacts available.</h2> |
|
30 |
</div> |
|
31 |
@else |
|
32 |
<div class="artefact-area mb-5"> |
|
33 |
<div class="card"> |
|
34 |
<div class="card-body"> |
|
35 |
<h2 class="text-uppercase card-title">{{$artefact->name}}</h2> |
|
36 |
<h5>{{$artefact->author}}</h5> |
|
37 |
<h6 class="card-subtitle mb-2 text-muted">{{$artefact->year}}, {{$artefact->pages}} pages</h6> |
|
38 |
<p class="card-text"> |
|
39 |
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. |
|
40 |
Mauris dolor felis, sagittis at, luctus sed, aliquam non, tellus. |
|
41 |
Fusce tellus odio, dapibus id fermentum quis, suscipit id erat. |
|
42 |
Morbi scelerisque luctus velit. Vivamus porttitor turpis ac leo. |
|
43 |
Morbi scelerisque luctus velit. |
|
44 |
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. |
|
45 |
</p> |
|
46 |
<p> |
|
47 |
@if (!is_null($artefact->metadata)) |
|
48 |
<a href="{{ url('/detail/' . $artefact->id) }}">Notes related to artefact</a> |
|
49 |
@endif |
|
50 |
</p> |
|
51 |
</div> |
|
52 |
</div> |
|
53 |
</div> |
|
54 |
@endif |
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
@endsection |
resources/views/layouts/app.blade.php | ||
---|---|---|
1 |
<!DOCTYPE html> |
|
2 |
<html lang="{{ config('app.locale', 'en') }}"> |
|
3 |
<head> |
|
4 |
<meta charset="utf-8"> |
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|
6 |
|
|
7 |
<title>{{ config('app.name', 'Dev') }} - @yield('title')</title> |
|
8 |
|
|
9 |
<!-- CSS styles --> |
|
10 |
<link href="{{ asset('css/app.css') }}" rel="stylesheet" type="text/css"> |
|
11 |
</head> |
|
12 |
<body> |
|
13 |
<nav aria-label="breadcrumb"> |
|
14 |
<ol class="breadcrumb"> |
|
15 |
@yield('breadcrumb') |
|
16 |
</ol> |
|
17 |
</nav> |
|
18 |
|
|
19 |
<div class="container"> |
|
20 |
<div class="content"> |
|
21 |
@yield('content') |
|
22 |
</div> |
|
23 |
|
|
24 |
<hr> |
|
25 |
<footer class="container"> |
|
26 |
© 2020 |
|
27 |
</footer> |
|
28 |
</div> |
|
29 |
</body> |
|
30 |
</html> |
resources/views/layouts/master.blade.php | ||
---|---|---|
1 |
<!DOCTYPE html> |
|
2 |
<html lang="{{ config('app.locale', 'en') }}"> |
|
3 |
<head> |
|
4 |
<meta charset="utf-8"> |
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|
6 |
|
|
7 |
<title>{{ config('app.name', 'Dev') }} - @yield('title')</title> |
|
8 |
|
|
9 |
<!-- CSS styles --> |
|
10 |
<link href="{{ asset('css/app.css') }}" rel="stylesheet" type="text/css"> |
|
11 |
</head> |
|
12 |
<body> |
|
13 |
<nav aria-label="breadcrumb"> |
|
14 |
<ol class="breadcrumb"> |
|
15 |
@yield('breadcrumb') |
|
16 |
</ol> |
|
17 |
</nav> |
|
18 |
|
|
19 |
<div class="container"> |
|
20 |
<div class="content"> |
|
21 |
@yield('content') |
|
22 |
</div> |
|
23 |
|
|
24 |
<hr> |
|
25 |
<footer class="container"> |
|
26 |
© 2020 |
|
27 |
</footer> |
|
28 |
</div> |
|
29 |
</body> |
|
30 |
</html> |
resources/views/pages/index.blade.php | ||
---|---|---|
1 |
@extends('layouts.master')
|
|
1 |
@extends('layouts.app')
|
|
2 | 2 |
|
3 | 3 |
@section('title', 'Homepage') |
4 | 4 |
|
routes/web.php | ||
---|---|---|
16 | 16 |
Route::get('/', 'PagesController@index'); |
17 | 17 |
|
18 | 18 |
Route::get('/artefact', 'ArtefactController@default'); |
19 |
|
|
20 |
Route::get('/artefact/{id}', 'ArtefactController@view'); |
Také k dispozici: Unified diff
Issue #7696 2h
[+] Vytvoření detailu artefaktu
[+] Refraktoring, doplnění dokumentace