Changes-complete

This commit is contained in:
Sanjay 2022-05-09 12:56:12 +05:30
parent aedd5127cb
commit ed8d56749b
3 changed files with 3 additions and 25 deletions

View File

@ -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([

View File

@ -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'));
}
} }

View File

@ -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.
*/ */