This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Book Detail</title> | |
</head> | |
<body> | |
<div style="background: #388BF2; font-size: 24px; color: white"> | |
Simple library app | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Book List</title> | |
</head> | |
<body> | |
<div style="background: #388BF2; font-size: 24px; color: white"> | |
Simple library app | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Home</title> | |
</head> | |
<body> | |
<div style="background: #388BF2; font-size: 24px; color: white"> | |
Simple library app | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function destroy($id) | |
{ | |
$book = Book::find($id); | |
$book->delete(); | |
return "book with id " . $id . " deleted"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function update(Request $request, $id) | |
{ | |
$book = Book::find($id); | |
$book->title = $request->title; | |
$book->author = $request->author; | |
$book->publication = $request->publication; | |
$book->year = $request->year; | |
$book->update(); | |
return $book; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function update(Request $request, $id) | |
{ | |
$book = Book::find($id); | |
$book->title = $request->title; | |
$book->author = $request->author; | |
$book->publication = $request->publication; | |
$book->year = $request->year; | |
$book->update(); | |
return $book; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function store(Request $request) | |
{ | |
$book = new Book(); | |
$book->title = $request->title; | |
$book->author = $request->author; | |
$book->publication = $request->publication; | |
$book->year = $request->year; | |
$book->save(); | |
return $book; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function show($id) | |
{ | |
$book = Book::find($id); | |
return $book; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function index() | |
{ | |
$books = Book::all(); | |
return $books; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App; | |
use Illuminate\Database\Eloquent\Model; | |
class Book extends Model | |
{ | |
// | |
} |