diff --git a/app/Http/Controllers/WebController.php b/app/Http/Controllers/WebController.php index 5a39e9d..f995902 100644 --- a/app/Http/Controllers/WebController.php +++ b/app/Http/Controllers/WebController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers; +use App\Models\Shelf; use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Routing\Controller as BaseController; use Illuminate\Foundation\Validation\ValidatesRequests; @@ -15,4 +16,10 @@ public function index() { return view('app.pages.index'); } + + public function read($shelf_slug){ + $shelf = Shelf::where('slug', '=', $shelf_slug)->first(); + + return view('app.pages.read')->withShelf($shelf); + } } diff --git a/optional.md b/optional.md index eab2e0b..537a04c 100644 --- a/optional.md +++ b/optional.md @@ -10,5 +10,9 @@ Use this space to write your solution: ``` +A new table called book_meta_data with the fields meta_id, book_id, name, value. +It would have a many to one relation with the books table with any amount of name => value records. +For now every book has there names published_at, author and cover. It leaves open the option to add +more meta data names in future as meta data suggests you can attach any amount of data to books. -``` \ No newline at end of file +``` diff --git a/resources/views/app/pages/read.blade.php b/resources/views/app/pages/read.blade.php new file mode 100644 index 0000000..8d256f5 --- /dev/null +++ b/resources/views/app/pages/read.blade.php @@ -0,0 +1,47 @@ +@extends('layouts.app') + + + + + +@section('content') +