Added page editing

This commit is contained in:
Dan Brown
2015-07-12 21:31:15 +01:00
parent eaa1765c7a
commit 3c7bd297ea
19 changed files with 252 additions and 23 deletions

View File

@ -7,19 +7,23 @@ use Illuminate\Http\Request;
use Illuminate\Support\Str;
use Oxbow\Http\Requests;
use Oxbow\Repos\BookRepo;
use Oxbow\Repos\PageRepo;
class BookController extends Controller
{
protected $bookRepo;
protected $pageRepo;
/**
* BookController constructor.
* @param BookRepo $bookRepo
* @param PageRepo $pageRepo
*/
public function __construct(BookRepo $bookRepo)
public function __construct(BookRepo $bookRepo, PageRepo $pageRepo)
{
$this->bookRepo = $bookRepo;
$this->pageRepo = $pageRepo;
}
/**
@ -58,7 +62,7 @@ class BookController extends Controller
$book = $this->bookRepo->newFromInput($request->all());
$slug = Str::slug($book->name);
while($this->bookRepo->countBySlug($slug) > 0) {
$slug += '1';
$slug .= '1';
}
$book->slug = $slug;
$book->save();