Merge pull request #5216 from shubh-mehrotra/5022
added update feature in header content of velocity #5022
This commit is contained in:
commit
f38ad8c4f0
|
|
@ -151,5 +151,16 @@ class ContentDataGrid extends DataGrid
|
|||
'label' => trans('admin::app.datagrid.delete'),
|
||||
'method' => 'POST',
|
||||
]);
|
||||
|
||||
$this->addMassAction([
|
||||
'type' => 'update',
|
||||
'label' => trans('admin::app.datagrid.update-status'),
|
||||
'action' => route('velocity.admin.content.mass-update'),
|
||||
'method' => 'POST',
|
||||
'options' => [
|
||||
'Active' => 1,
|
||||
'Inactive' => 0,
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -181,4 +181,25 @@ class ContentController extends Controller
|
|||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
}
|
||||
|
||||
/**
|
||||
* To mass update the content
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function massUpdate()
|
||||
{
|
||||
$contentIds = explode(',', request()->input('indexes'));
|
||||
$updateOption = request()->input('update-options');
|
||||
|
||||
foreach ($contentIds as $contentId) {
|
||||
$content = $this->contentRepository->find($contentId);
|
||||
|
||||
$content->update(['status' => $updateOption]);
|
||||
}
|
||||
|
||||
session()->flash('success', trans('velocity::app.admin.contents.mass-update-success'));
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
|
|
@ -36,6 +36,10 @@ Route::group(['middleware' => ['web', 'admin_locale']], function () {
|
|||
'redirect' => 'velocity.admin.content.index'
|
||||
])->name('velocity.admin.content.mass-delete');
|
||||
|
||||
Route::post('/content/masss-update', [ContentController::class, 'massUpdate'])->defaults('_config', [
|
||||
'redirect' => 'velocity.admin.content.index'
|
||||
])->name('velocity.admin.content.mass-update');
|
||||
|
||||
Route::get('/meta-data', [ConfigurationController::class, 'renderMetaData'])->defaults('_config', [
|
||||
'view' => 'velocity::admin.meta-info.meta-data'
|
||||
])->name('velocity.admin.meta-data');
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ return [
|
|||
'no-result-found' => 'No record found.',
|
||||
'search-hint' => 'Search product here...',
|
||||
'mass-delete-success' => 'Selected content deleted successfully.',
|
||||
'mass-update-success' => 'Selected content updated successfully.',
|
||||
'tab' => [
|
||||
'page' => 'Page Setting',
|
||||
'content' => 'Content Setting',
|
||||
|
|
|
|||
Loading…
Reference in New Issue