Adding method to find a page by id

parent 305cb34e
......@@ -7,6 +7,7 @@ use Illuminate\Routing\Controller;
use Modules\Page\Entities\Page;
use Modules\Page\Http\Requests\CreatePageRequest;
use Modules\Page\Repositories\PageRepository;
use Modules\Page\Transformers\FullPageTransformer;
use Modules\Page\Transformers\PageTransformer;
class PageController extends Controller
......@@ -36,6 +37,11 @@ class PageController extends Controller
]);
}
public function find(Page $page)
{
return new FullPageTransformer($page);
}
public function destroy(Page $page)
{
$this->page->destroy($page);
......
......@@ -23,5 +23,10 @@ $router->group(['prefix' => '/page'], function (Router $router) {
'uses' => 'PageController@store',
'middleware' => 'token-can:page.pages.create',
]);
$router->post('pages/{page}', [
'as' => 'api.page.page.find',
'uses' => 'PageController@find',
'middleware' => 'token-can:page.pages.edit',
]);
$router->get('templates', 'PageTemplatesController')->name('api.page.page-templates.index');
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment