PATH:
home
/
lab2454c
/
costbloc.com
/
app
/
Http
/
Controllers
<?php /** * @package BatchController * @author TechVillage <support@techvill.org> * @contributor Al Mamun <[almamun.techvill@gmail.com]> * @created 29-12-2022 */ namespace App\Http\Controllers; use Illuminate\Http\Request; use Illuminate\Support\Facades\Validator; class BatchController extends Controller { /** * Delete batch data * * @param Request $request * @return array $response */ public function destroy(Request $request) { $response = ['status' => 'failed', 'message' => __('Something went wrong, please try again.')]; if (config('martvill.is_demo')) { $response['message'] = __('Batch operation is disabled in demo mode.'); return $response; } if (!$this->isValid($request)) { return $response; } try { $model = new $request->namespace; $model->whereIn($request->column, $request->records)->delete(); $model->forgetCache(); return ['status' => 'success', 'message' => __('Batch :x has been successfully deleted.', ['x' => $this->getModelName($request->namespace)])]; } catch (\Exception $e) { $response['message'] = $e->getMessage(); return $response; } } /** * Check validity * * @param Request $request * @return boolean */ private function isValid($request) { $validate = !Validator::make($request->all(), [ 'records' => 'required', 'namespace' => 'required', 'column' => 'required' ])->fails(); return $validate && class_exists($request->namespace); } /** * Get model name * * @param string $namespace * @return string */ private function getModelName($namespace) { $modelName = explode('\\', $namespace); return end($modelName); } }
[-] CategoryController.php
[edit]
[-] ImportController.php
[edit]
[-] PermissionRoleController.php
[edit]
[-] BatchController.php
[edit]
[-] WithdrawalController.php
[edit]
[-] SsoController.php
[edit]
[-] ExportController.php
[edit]
[-] OrderStatusController.php
[edit]
[-] ProductSettingController.php
[edit]
[+]
..
[-] UserController.php
[edit]
[+]
Api
[-] EmailController.php
[edit]
[-] AttributeController.php
[edit]
[-] MailTemplateController.php
[edit]
[+]
Site
[-] AdminOrderController.php
[edit]
[-] AttributeGroupController.php
[edit]
[-] EmailConfigurationController.php
[edit]
[-] OrderSettingController.php
[edit]
[-] Controller.php
[edit]
[-] AccountSettingController.php
[edit]
[-] SystemInfoController.php
[edit]
[-] LoginController.php
[edit]
[-] AddonsMangerController.php
[edit]
[-] CurrencyController.php
[edit]
[-] BrandController.php
[edit]
[-] FilesController.php
[edit]
[-] ReviewController.php
[edit]
[-] LanguageController.php
[edit]
[-] RoleController.php
[edit]
[-] TransactionController.php
[edit]
[-] VendorController.php
[edit]
[-] PreferenceController.php
[edit]
[-] CompanySettingController.php
[edit]
[-] ProductController.php
[edit]
[-] DashboardController.php
[edit]
[-] MaintenanceModeController.php
[edit]
[+]
Vendor