bookinventory/app/Http/Controllers/BookController.php

94 lines
1.8 KiB
PHP
Raw Normal View History

2020-12-21 07:09:34 +00:00
<?php
namespace App\Http\Controllers;
2020-12-27 00:34:07 +00:00
use App\Models\Book;
2020-12-21 07:09:34 +00:00
use Illuminate\Http\Request;
2020-12-26 10:46:23 +00:00
class BookController extends Controller {
2020-12-21 07:09:34 +00:00
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
2020-12-26 10:46:23 +00:00
public function index() {
2020-12-21 07:09:34 +00:00
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
2020-12-26 10:46:23 +00:00
public function create() {
2020-12-21 07:09:34 +00:00
//
}
/**
* Store a newly created resource in storage.
*
2020-12-26 10:46:23 +00:00
* @param \Illuminate\Http\Request $request
2020-12-21 07:09:34 +00:00
* @return \Illuminate\Http\Response
*/
2020-12-26 10:46:23 +00:00
public function store(Request $request) {
2020-12-21 07:09:34 +00:00
//
}
/**
* Display the specified resource.
*
2020-12-26 10:46:23 +00:00
* @param int $id
2020-12-21 07:09:34 +00:00
* @return \Illuminate\Http\Response
*/
2020-12-26 10:46:23 +00:00
public function show($id) {
2020-12-27 00:34:07 +00:00
$book = Book::find($id);
if (!$book) {
abort(404);
}
return view('books.show', [ 'book' => $book ]);
2020-12-21 07:09:34 +00:00
}
/**
* Show the form for editing the specified resource.
*
2020-12-26 10:46:23 +00:00
* @param int $id
2020-12-21 07:09:34 +00:00
* @return \Illuminate\Http\Response
*/
2020-12-26 10:46:23 +00:00
public function edit($id) {
2020-12-21 07:09:34 +00:00
//
}
/**
* Update the specified resource in storage.
*
2020-12-26 10:46:23 +00:00
* @param \Illuminate\Http\Request $request
* @param int $id
2020-12-21 07:09:34 +00:00
* @return \Illuminate\Http\Response
*/
2020-12-26 10:46:23 +00:00
public function update(Request $request, $id) {
2020-12-21 07:09:34 +00:00
//
}
/**
* Remove the specified resource from storage.
*
2020-12-26 10:46:23 +00:00
* @param int $id
2020-12-21 07:09:34 +00:00
* @return \Illuminate\Http\Response
*/
2020-12-26 10:46:23 +00:00
public function destroy($id) {
2020-12-27 00:34:07 +00:00
$book = Book::find($id);
if (!$book) {
abort(404);
}
$book->delete();
return response()->json([
'success' => true
]);
2020-12-21 07:09:34 +00:00
}
}