示例#1
0
 public function postContact(FormContactRequest $request)
 {
     if (!empty($request)) {
         $data = $request->all();
         $data['customer_id'] = Auth::customer()->user()->id;
         $data['flagactive'] = $request->get('flagactive', 1);
         if ($request->id) {
             $obj = Contact::find($request->id);
             $obj->update($data);
         } else {
             $obj = Contact::create($data);
         }
         return array('msg' => 'ok', 'state' => 1, 'data' => null);
     }
     return array('msg' => 'Error al guardar el modelo', 'state' => 0, 'data' => null);
 }
 public function postContact(FormContactRequest $request)
 {
     if (!empty($request)) {
         $data = $request->all();
         if (empty($data['customer_id'])) {
             $data['geocode'] = '0';
         } else {
             $data['geocode'] = $request->input('customer_id');
         }
         if ($request->id) {
             $obj = Hostpots::find($request->id);
             $obj->update($data);
         } else {
             //                if ($request->input('customer_id')) {
             if (Auth::customer()->user()->type != 2) {
                 $data['manager'] = "1";
                 $obj = Hostpots::create($data);
             } else {
                 return array('msg' => 'Error al guardar el modelo', 'state' => 0, 'data' => null);
             }
         }
         return array('msg' => 'ok', 'state' => 1, 'data' => null);
     }
     return array('msg' => 'Error al guardar el modelo', 'state' => 0, 'data' => null);
 }