FEATURE: use more route model binding

This commit is contained in:
Michal Kváček
2017-08-01 19:10:55 +02:00
parent a7e91ef499
commit 3275e5aeed
22 changed files with 163 additions and 159 deletions
@@ -7,6 +7,8 @@ use App\CMS\Interactions\Admin\Content\ChangeStatus;
use App\CMS\Interactions\Admin\Content\DeletePage;
use App\CMS\Interactions\Admin\Content\SetHomepage;
use App\Http\Controllers\Admin\Controller;
use App\Models\Content\Content;
use App\Models\Content\ContentHistory;
class ContentActions extends Controller
{
@@ -25,15 +27,13 @@ class ContentActions extends Controller
* This method is called in static page overview from quick actions. It checks if status is valid, if page exists
* and updates status.
*
* @param $id
* @param $status
* @param Content $page
* @param $status
*
* @return \Illuminate\Http\RedirectResponse
*/
public function changeStatus($id, $status)
public function changeStatus(Content $page, $status)
{
$page = $this->content->getOne($id);
Interaction::handle(ChangeStatus::class, ['status' => $status], $page);
// redirect back to overview with info for user
@@ -45,14 +45,12 @@ class ContentActions extends Controller
/**
* Delete page
*
* @param $id
* @param Content $page
*
* @return \Illuminate\Http\RedirectResponse
*/
public function delete($id)
public function delete(Content $page)
{
$page = $this->content->getOne($id);
Interaction::handle(DeletePage::class, [], $page);
// redirect back to overview with info for user
@@ -66,14 +64,12 @@ class ContentActions extends Controller
/**
* Sets page as homepage
*
* @param $id
* @param Content $page
*
* @return \Illuminate\Http\RedirectResponse
*/
public function setHomepage($id)
public function setHomepage(Content $page)
{
$page = $this->content->getOne($id);
Interaction::handle(SetHomepage::class, [], $page);
// redirect back to overview with info for user