Merge pull request #5216 from shubh-mehrotra/5022

added update feature in header content of velocity #5022
This commit is contained in:
Glenn Hermans 2021-10-11 12:10:52 +02:00 committed by GitHub
commit f38ad8c4f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 0 deletions

View File

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

View File

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

View File

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

View File

@ -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',