Ejemplo n.º 1
0
 /**
  * @param $id 用户id
  * @return Customer
  */
 public function company($id, Company $company)
 {
     return $company->searchCustomer($id)->withOnly('field', ['id', 'name'])->first();
 }
Ejemplo n.º 2
0
 public function transform(Company $company)
 {
     return $company->toArray();
 }
Ejemplo n.º 3
0
 private function companyList()
 {
     $company_id = 1;
     Company::create(array('company_id' => $company_id, 'company_name' => 'Fifth Agency'));
     CompanyInfo::create(array('company_id' => $company_id, 'owner_first_name' => 'Sample', 'owner_middle_name' => 'Sample', 'owner_last_name' => 'Sample', 'address' => 'Sample', 'email' => '*****@*****.**', 'contact_number' => 'Sample'));
 }
Ejemplo n.º 4
0
 /**
  *更新项目介绍
  */
 public function updateTeam()
 {
     //获取项目id
     $id = $this->request->get('id');
     //获取公司id
     $company = Company::find($id);
     if (!$company) {
         return return_rest('0', '', '公司不存在');
     }
     $content = $this->request->get('content');
     //更新团队优势 团队介绍
     $extend = CompanyExtend::where('company_id', $company->id)->first();
     if (is_null($extend)) {
         return return_rest('0', '', '更新失败');
     }
     $extend->story = $content;
     if ($extend->save()) {
         return return_rest('1', '', '更新成功');
     }
     return return_rest('0', '', '更新失败');
 }
Ejemplo n.º 5
0
 public function delete($id)
 {
     $this->checkPageAction($this->page_id, Action::$Delete);
     $response = array('status' => false, 'msg' => 'Unable to find company information!');
     if (Request::ajax() && Company::find($id) && Input::has('reason')) {
         $reason = Input::get('reason');
         $company = Company::find($id);
         $company->company_status = $company->company_status == 'Active' ? 'Inactive' : 'Active';
         if ($company->save()) {
             if ($company->company_status == 'Inactive') {
                 $inactiveHistoryInfo = array('company_id' => $id, 'reason' => $reason, 'datetime' => Carbon::now());
                 $company->inactiveHistory()->insert($inactiveHistoryInfo);
             }
             $response['status'] = true;
         }
         return json_encode($response);
     }
     return json_encode($response);
 }
Ejemplo n.º 6
0
 /**
  * 创建新公司
  */
 public function store()
 {
     DB::beginTransaction();
     try {
         $company = new Company();
         $company->name = $this->request->get('name');
         $company->full_name = $this->request->get('full_name');
         $company->logo = $this->request->get('logo');
         $company->website = $this->request->get('website');
         $company->brief = $this->request->get('brief');
         $company->address = $this->request->get('province') . $this->request->get('city') . $this->request->get('dist');
         if (empty($this->request->get('sub_field'))) {
             $company->field_id = $this->request->get('company_field');
         } else {
             $company->field_id = $this->request->get('sub_field');
         }
         //获取公司类型
         $company->type = $this->request->get('type');
         if ($this->request->has('iphoneAppstoreLink')) {
             $company->iphoneAppstoreLink = $this->request->get('iphoneAppstoreLink');
         }
         if ($this->request->has('androidLink')) {
             $company->androidLink = $this->request->get('androidLink');
         }
         if ($this->request->has('website')) {
             $company->website = $this->request->get('website');
         }
         if ($this->request->has('weixin')) {
             $company->weixin = $this->request->get('weixin');
         }
         if ($this->request->has('operationStatus')) {
             $company->operationStatus = $this->request->get('operationStatus');
         }
         $company->save();
         //增加公司详情
         $extend = new CompanyExtend();
         $extend->company_id = $company->id;
         $extend->projectAdvantage = $this->request->get('projectAdvantage');
         $extend->dataLights = $this->request->get('dataLights');
         $extend->story = $this->request->get('story');
         $extend->save();
         //增加公司认证信息
         $auth = new CompanyAuth();
         $auth->customer_id = $this->user()->id;
         $auth->company_id = $company->id;
         $auth->position = $this->request->get('position');
         $auth->position_detail = $this->request->get('position_detail');
         $auth->start_year = $this->request->get('startYear');
         $auth->start_month = $this->request->get('startMonth');
         $auth->is_today = $this->request->get('is_today');
         if ($this->request->get('is_today') == 0) {
             $auth->end_year = $this->request->get('end_year') ? $this->request->get('endYear') : Carbon::now()->year;
             $auth->end_month = $this->request->get('end_month') ? $this->request->get('endMonth') : Carbon::now()->month;
         }
         $auth->bizCardLinkFile = $this->request->get('auth');
         $auth->company_name = $company->name;
         $auth->save();
         //更新用户公司信息
         //创建公司 如果用户类型为3游客 变更为1创业者
         Customer::where('id', $this->user()->id)->update(['company_id' => $company->id, 'position' => $this->request->get('position'), 'position_detail' => $this->request->get('position_detail'), 'is_company_creator' => 1, 'type' => 1, 'type_state' => 1]);
         //添加创业经历
         $experience = new CompanyExperience();
         $experience->company_id = $company->id;
         $experience->startYear = $this->request->get('startYear');
         $experience->startMouth = $this->request->get('startMonth');
         $experience->is_today = $this->request->get('is_today');
         $experience->endYear = $this->request->has('endYear') ? $this->request->has('endYear') : '';
         $experience->endMouth = $this->request->has('endMonth') ? $this->request->has('endMonth') : '';
         $experience->bizCardLink = $this->request->get('auth');
         $experience->customer_id = $this->user()->id;
         $experience->save();
         //公司介绍
         //            $introduce=new CompanyIntroduce();
         if ($this->request->has('product')) {
             CompanyIntroduce::create(['company_id' => $company->id, 'config_id' => 1, 'content' => $this->request->get('product')]);
         }
         if ($this->request->has('consumer')) {
             CompanyIntroduce::create(['company_id' => $company->id, 'config_id' => 2, 'content' => $this->request->get('consumer')]);
         }
         if ($this->request->has('future')) {
             CompanyIntroduce::create(['company_id' => $company->id, 'config_id' => 3, 'content' => $this->request->get('future')]);
         }
         if ($this->request->has('similar')) {
             CompanyIntroduce::create(['company_id' => $company->id, 'config_id' => 4, 'content' => $this->request->get('similar')]);
         }
         if ($this->request->has('others')) {
             CompanyIntroduce::create(['company_id' => $company->id, 'config_id' => 5, 'content' => $this->request->get('others')]);
         }
         DB::commit();
         return return_rest('1', '', '公司添加成功');
     } catch (\Exception $e) {
         DB::rollBack();
         return return_rest('0', '', $e->getMessage());
     }
 }