Example #1
0
 public function deleteRelation($type, $typeID)
 {
     switch ($type) {
         case 'agency':
             if ($this->agency()->detach($typeID)) {
                 if ($this->delete()) {
                     return AgencyAdvertiserManagerModel::find($typeID)->contact;
                 }
             }
             break;
         case 'advertiser':
             if ($this->advertiser()->detach($typeID)) {
                 if ($this->delete()) {
                     return AdvertiserAdvertiserManagerModel::find($typeID)->contact;
                 }
             }
             break;
     }
 }
 public function getListAgency($keyword, $id)
 {
     $model = new AgencyAdvertiserManagerModel();
     if ($id > 0) {
         $this->data['listAgency'] = $model->where('id', $id)->get();
     } else {
         $this->data['listAgency'] = $model->searchByCapital($keyword);
     }
     return View::make('listAgency', $this->data)->render();
 }