Changes-complete
This commit is contained in:
parent
aedd5127cb
commit
ed8d56749b
|
|
@ -60,8 +60,10 @@ class CMSPageDataGrid extends DataGrid
|
||||||
$this->addAction([
|
$this->addAction([
|
||||||
'title' => trans('admin::app.datagrid.view'),
|
'title' => trans('admin::app.datagrid.view'),
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
'route' => 'shop.cms.view.front',
|
'route' => 'shop.cms.page',
|
||||||
|
'index' => 'url_key',
|
||||||
'icon' => 'icon eye-icon',
|
'icon' => 'icon eye-icon',
|
||||||
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->addAction([
|
$this->addAction([
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ class PagePresenterController extends Controller
|
||||||
*/
|
*/
|
||||||
public function __construct(protected CmsRepository $cmsRepository)
|
public function __construct(protected CmsRepository $cmsRepository)
|
||||||
{
|
{
|
||||||
$this->_config = request('_config');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -30,23 +29,4 @@ class PagePresenterController extends Controller
|
||||||
|
|
||||||
return view('shop::cms.page')->with('page', $page);
|
return view('shop::cms.page')->with('page', $page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Preview the CMS page from datagrid.
|
|
||||||
*
|
|
||||||
* @param int $id
|
|
||||||
* @return \Illuminate\View\View
|
|
||||||
*/
|
|
||||||
public function view($id)
|
|
||||||
{
|
|
||||||
$page = $this->cmsRepository->findOrFail($id);
|
|
||||||
|
|
||||||
request()->merge(['url_key' => $page->url_key]);
|
|
||||||
|
|
||||||
if (is_null($page)) {
|
|
||||||
abort(404);
|
|
||||||
}
|
|
||||||
|
|
||||||
return view($this->_config['view'], compact('page'));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -24,10 +24,6 @@ Route::group(['middleware' => ['web', 'locale', 'theme', 'currency']], function
|
||||||
*/
|
*/
|
||||||
Route::get('page/{slug}', [PagePresenterController::class, 'presenter'])->name('shop.cms.page');
|
Route::get('page/{slug}', [PagePresenterController::class, 'presenter'])->name('shop.cms.page');
|
||||||
|
|
||||||
Route::get('preview/{id}', [PagePresenterController::class, 'view'])->defaults('_config', [
|
|
||||||
'view' => 'shop::cms.page',
|
|
||||||
])->name('shop.cms.view.front');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fallback route.
|
* Fallback route.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue