public function check_color(Request $request) { if (!$this->hasPermission($this->menuPermissionName)) { return view($this->viewPermissiondeniedName); } $input = $request->only('id', 'carmodelid', 'colorid'); $carmodelcolor = CarModelColor::where('id', '!=', $input['id'])->where('carmodelid', $input['carmodelid'])->where('colorid', $input['colorid'])->first(); if ($carmodelcolor != null) { return $carmodelcolor->color->code; } }
public function readSelectlist($carmodelid) { $colorids = CarModelColor::where('carmodelid', $carmodelid)->lists('colorid'); $colors = Color::whereIn('id', $colorids)->orderBy('code', 'asc')->get(['id', 'code', 'name']); return $colors; }