public function store(Request $request)
 {
     $keys = 'username,realname,idcard,name,address,phone,brand_ids';
     $data = $this->autoValidate($request, 'agent.audit-store', $keys);
     $data += ['fid' => $this->factory->getKey()];
     $agent_audit = AgentAudit::create($data);
     return $this->success('', url('factory/agent-audit'));
 }
 public function update(Request $request, $id)
 {
     $agent_audit = AgentAudit::find($id);
     if (empty($agent_audit)) {
         return $this->failure_noexists();
     }
     if ($agent_audit->doAudit()) {
         return $this->success('agent.success_audit');
     } else {
         return $this->failure('agent.failure_audit');
     }
 }