input("customer_id"); if (!$customerId)return ["success"=>false,"data"=>"非法参数"]; return ["success"=>true,"data"=>app("CustomerLogService")->get(["customer_id"=>$customerId],["status:id,name","user:id,name"])]; } public function update(Request $request) { $id = $request->input("id"); if (!$id) return ["success"=>false,"data"=>"非法参数"]; $params = []; if ($request->has("description"))$params["description"] = $request->input("description"); if ($request->has("customer_log_status_id"))$params["customer_log_status_id"] = $request->input("customer_log_status_id"); return ["success"=>true,"data"=>app("CustomerLogService")->update(["id"=>$id],$params)]; } public function store(Request $request) { $customerId = $request->input("customer_id"); $description = $request->input("description"); $customerLogStatusId = $request->input("customer_log_status_id"); if (!$customerId || !$description || !$customerLogStatusId)return ["success"=>false,"data"=>"检查您的输入"]; /** @var CustomerLog $log */ $log = app("CustomerLogService")->create([ "customer_id" => $customerId, "description" => $description, "customer_log_status_id" => $customerLogStatusId, "user_id" => Auth::id(), ]); $log->load(["status:id,name","user:id,name"]); return ["success"=>true,"data"=>$log]; } }