public function insertData($userId) { $this->created_by = $userId; $this->storeData($userId); $this->updateUser(); $websiteModel = new PublisherSiteBaseModel(); $status = $this->status == 3 ? 1 : 0; $websiteData = array('name' => $this->site_name, 'url' => $this->site_url, 'premium_publisher' => $this->premium_publisher, 'domain_checking' => $this->domain_checking, 'vast_tag' => $this->vast_tag, 'network_publisher' => $this->network_publisher, 'mobile_ad' => $this->mobile_ad, 'status' => $status); $websiteModel->insertData($userId, $this->id, $websiteData); return $this; }
public function postUpdateSite($pid = 0, $id = 0) { $validate = Validator::make(Input::all(), array('name' => 'required', 'url' => 'required'), array('name.required' => trans('Please Enter Site Name'), 'url.required' => trans('Please Enter Site Url'))); if ($validate->passes()) { if ($id == 0) { $item = new PublisherSiteBaseModel(); if ($item->insertData($this->user->id, $pid, Input::all())) { $this->data['id'] = $item->id; $this->data['pid'] = $pid; Session::flash('flash-message', 'Create Website Success!'); return TRUE; } } else { $item = PublisherSiteBaseModel::find($id); if ($item) { if ($item->updateData($this->user->id, $pid, Input::all())) { (new Delivery())->renewCache('publisher_site', $item->id); $this->data['id'] = $item->id; $this->data['pid'] = $pid; Session::flash('flash-message', 'Update Website Success!'); return TRUE; } } } } else { $this->data['errors'] = $validate->messages(); } }