paginate(["unit"]); return response()->view('maintenance.priceModel.storage.index',compact("models")); } public function storageCreate() { if(!Gate::allows('计费模型-仓储-录入')){ return redirect('denied'); } $units = app('UnitService')->getSelection(); return response()->view('maintenance.priceModel.storage.create',compact("units")); } public function storageStore(Request $request) { if(!Gate::allows('计费模型-仓储-录入')){ return redirect('denied'); } $this->storageValidator($request->input())->validate(); app('OwnerStoragePriceModelService')->create($request->input()); return response()->redirectTo('maintenance/priceModel/storage')->with('successTip',"创建成功!"); } public function storageEdit($id) { if(!Gate::allows('计费模型-仓储-编辑')){ return redirect('denied'); } $model = app('OwnerStoragePriceModelService')->find($id); $units = app('UnitService')->getSelection(); return response()->view('maintenance.priceModel.storage.create',compact("units","model")); } public function storageUpdate(Request $request) { if(!Gate::allows('计费模型-仓储-编辑')){ return redirect('denied'); } app('OwnerStoragePriceModelService')->update(["id"=>$request->input("id")],[ "counting_type" => $request->input("counting_type"), "using_type" => $request->input("using_type"), "minimum_area" => $request->input("minimum_area"), "price" => $request->input("price"), "discount_type" => $request->input("discount_type"), "discount_value"=> $request->input("discount_value"), "unit_id" => $request->input("unit_id"), ]); return response()->redirectTo('maintenance/priceModel/storage')->with('successTip',"更新成功!"); } public function storageDestroy($id) { app("OwnerStoragePriceModelService")->destroy($id); return ["success"=>true]; } private function storageValidator(array $params) { return Validator::make($params,[ 'counting_type'=>['required'], 'using_type'=>['required'], 'minimum_area'=>['nullable','numeric','min:0'], 'discount_value'=>['nullable','numeric','min:0'], 'price'=>['required','numeric','min:0'], 'discount_type'=>['required'], 'unit_id'=>['required','integer'], ],[ 'required'=>':attribute 为必填项', 'min'=>':attribute 不得小于0', 'integer'=>':attribute 未选择', ],[ 'counting_type' =>"计费类型", 'using_type' =>"用仓类型", 'minimum_area' =>"最低起租面积", 'price' =>"单价", 'discount_type' =>"减免类型", 'discount_value'=>"减免值", 'unit_id' =>"单位", ]); } public function operationIndex(Request $request){ if(!Gate::allows('计费模型-作业-查询')){ return redirect('denied'); } $models = app('OwnerPriceOperationService')->paginate($request->input(),["ownerInStorageRules","ownerOutStorageRules"]); $owners = app("OwnerService")->getSelection(); return response()->view('maintenance.priceModel.operation.index',compact("models","owners")); } public function operationCreate(){ if(!Gate::allows('计费模型-作业-录入')){ return redirect('denied'); } return response()->view('maintenance.priceModel.operation.create'); } public function expressIndex(){ if(!Gate::allows('计费模型-快递-查询')){ return redirect('denied'); } return response()->view('maintenance.priceModel.express.index'); } public function expressCreate(){ if(!Gate::allows('计费模型-快递-录入')){ return redirect('denied'); } return response()->view('maintenance.priceModel.express.create'); } public function logisticIndex(){ if(!Gate::allows('计费模型-物流-查询')){ return redirect('denied'); } return response()->view('maintenance.priceModel.logistic.index'); } public function logisticCreate(){ if(!Gate::allows('计费模型-物流-录入')){ return redirect('denied'); } return response()->view('maintenance.priceModel.logistic.create'); } public function directLogisticIndex(){ if(!Gate::allows('计费模型-直发-查询')){ return redirect('denied'); } return response()->view('maintenance.priceModel.directLogistic.index'); } public function directLogisticCreate(){ if(!Gate::allows('计费模型-直发-录入')){ return redirect('denied'); } return response()->view('maintenance.priceModel.directLogistic.create'); } }