1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-31 15:24:31 +03:00

Initial commit

This commit is contained in:
Dan Brown
2015-07-12 20:01:42 +01:00
commit eaa1765c7a
99 changed files with 8011 additions and 0 deletions

50
app/Repos/BookRepo.php Normal file
View File

@ -0,0 +1,50 @@
<?php namespace Oxbow\Repos;
use Oxbow\Book;
class BookRepo
{
protected $book;
/**
* BookRepo constructor.
* @param $book
*/
public function __construct(Book $book)
{
$this->book = $book;
}
public function getById($id)
{
return $this->book->findOrFail($id);
}
public function getAll()
{
return $this->book->all();
}
public function getBySlug($slug)
{
return $this->book->where('slug', '=', $slug)->first();
}
public function newFromInput($input)
{
return $this->book->fill($input);
}
public function countBySlug($slug)
{
return $this->book->where('slug', '=', $slug)->count();
}
public function destroyById($id)
{
$book = $this->getById($id);
$book->delete();
}
}