Skip to content

Instantly share code, notes, and snippets.

View ecojuntak's full-sized avatar
🌏

Eko Simanjuntak ecojuntak

🌏
View GitHub Profile
<html>
<head>
<title>Book Detail</title>
</head>
<body>
<div style="background: #388BF2; font-size: 24px; color: white">
Simple library app
</div>
<html>
<head>
<title>Book List</title>
</head>
<body>
<div style="background: #388BF2; font-size: 24px; color: white">
Simple library app
</div>
<html>
<head>
<title>Home</title>
</head>
<body>
<div style="background: #388BF2; font-size: 24px; color: white">
Simple library app
</div>
public function destroy($id)
{
$book = Book::find($id);
$book->delete();
return "book with id " . $id . " deleted";
}
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;
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;
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;
public function show($id)
{
$book = Book::find($id);
return $book;
}
public function index()
{
$books = Book::all();
return $books;
}
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Book extends Model
{
//
}