Exemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store()
 {
     $advBuss = new PublisherBusiness();
     $data = Input::all();
     $validator = $this->checkValidation();
     if ($validator->fails()) {
         $messages = $validator->messages();
         foreach ($messages->all() as $message) {
             $msg[] = $message;
         }
         return $this->errorMessage($msg);
     }
     $img_hash1 = $advBuss->imageUpload($data['img_hash1'], $this->uploaddir);
     if (isset($img_hash1) and !empty($img_hash1)) {
         $data['img_hash1'] = $img_hash1;
     }
     $img_hash2 = $advBuss->imageUpload($data['img_hash2'], $this->uploaddir);
     if (isset($img_hash2) and !empty($img_hash2)) {
         $data['img_hash2'] = $img_hash2;
     }
     $img_hash3 = $advBuss->imageUpload($data['img_hash3'], $this->uploaddir);
     if (isset($img_hash3) and !empty($img_hash3)) {
         $data['img_hash3'] = $img_hash3;
     }
     $userDetail = $advBuss->getDetailByUserId($data['user_id']);
     if (empty($userDetail)) {
         $advertiserProfile = $advBuss->insert($data);
         $msg[] = "Profile saved successfully.";
         return $this->successMessageWithVar($msg, $advertiserProfile);
     } else {
         $advertiserProfile = $advBuss->updateData($data);
         $msg[] = "Profile updated successfully.";
         return $this->successMessageWithVar($msg, $advertiserProfile);
     }
 }
Exemplo n.º 2
0
 public function insert($data)
 {
     $user = new PublisherBusiness();
     if (isset($data['user_id'])) {
         $user->user_id = $data['user_id'];
     }
     if (isset($data['cat_type'])) {
         $user->cat_type = $data['cat_type'];
     }
     if (isset($data['img_hash1'])) {
         $user->img_hash1 = $data['img_hash1'];
     }
     if (isset($data['img_hash2'])) {
         $user->img_hash2 = $data['img_hash2'];
     }
     if (isset($data['img_hash3'])) {
         $user->img_hash3 = $data['img_hash3'];
     }
     if (isset($data['min_amt'])) {
         $user->min_amt = $data['min_amt'];
     }
     if (isset($data['max_amt'])) {
         $user->max_amt = $data['max_amt'];
     }
     if (isset($data['avg_space'])) {
         $user->avg_space = $data['avg_space'];
     }
     if (isset($data['desc'])) {
         $user->desc = $data['desc'];
     }
     $user->save();
     return $user;
 }