]> BookStack Code Mirror - bookstack/blobdiff - app/Http/Controllers/Api/BookApiController.php
Filtered scripts in custom HTML head for exports
[bookstack] / app / Http / Controllers / Api / BookApiController.php
index 8ec9fdc066ff36eeecaf078c7c762f839560ec65..81ac9c7aa6c56e44bd2551e379d37e1f75ec5882 100644 (file)
@@ -1,10 +1,8 @@
 <?php namespace BookStack\Http\Controllers\Api;
 
-use BookStack\Actions\ActivityType;
-use BookStack\Entities\Book;
+use BookStack\Entities\Models\Book;
 use BookStack\Entities\Repos\BookRepo;
 use BookStack\Exceptions\NotifyException;
-use BookStack\Facades\Activity;
 use Illuminate\Contracts\Container\BindingResolutionException;
 use Illuminate\Http\Request;
 use Illuminate\Validation\ValidationException;
@@ -27,9 +25,6 @@ class BookApiController extends ApiController
         ],
     ];
 
-    /**
-     * BooksApiController constructor.
-     */
     public function __construct(BookRepo $bookRepo)
     {
         $this->bookRepo = $bookRepo;
@@ -42,7 +37,7 @@ class BookApiController extends ApiController
     {
         $books = Book::visible();
         return $this->apiListingResponse($books, [
-            'id', 'name', 'slug', 'description', 'created_at', 'updated_at', 'created_by', 'updated_by', 'image_id',
+            'id', 'name', 'slug', 'description', 'created_at', 'updated_at', 'created_by', 'updated_by', 'owned_by', 'image_id',
         ]);
     }
 
@@ -64,7 +59,7 @@ class BookApiController extends ApiController
      */
     public function read(string $id)
     {
-        $book = Book::visible()->with(['tags', 'cover', 'createdBy', 'updatedBy'])->findOrFail($id);
+        $book = Book::visible()->with(['tags', 'cover', 'createdBy', 'updatedBy', 'ownedBy'])->findOrFail($id);
         return response()->json($book);
     }
 
@@ -84,9 +79,9 @@ class BookApiController extends ApiController
     }
 
     /**
-     * Delete a single book from the system.
-     * @throws NotifyException
-     * @throws BindingResolutionException
+     * Delete a single book.
+     * This will typically send the book to the recycle bin.
+     * @throws \Exception
      */
     public function delete(string $id)
     {
@@ -96,4 +91,4 @@ class BookApiController extends ApiController
         $this->bookRepo->destroy($book);
         return response('', 204);
     }
-}
\ No newline at end of file
+}