当前位置: 首页>>代码示例>>PHP>>正文


PHP Company::toArray方法代码示例

本文整理汇总了PHP中Company::toArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Company::toArray方法的具体用法?PHP Company::toArray怎么用?PHP Company::toArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Company的用法示例。


在下文中一共展示了Company::toArray方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make(Input::all(), array('name' => 'required', 'description' => 'required', 'url' => 'required|url', 'photo' => 'required|image'));
     if ($validator->fails()) {
         return Response::json($validator->messages(), 400);
     }
     $company = new Company();
     $company->name = Input::get('name');
     $company->description = Input::get('description');
     $company->url = Input::get('url');
     //temporary for territory
     $company->territory_id = 1;
     $company->save();
     //save category and tags if available
     foreach (Input::get('category') as $catid) {
         $company->categories()->attach($catid);
     }
     foreach (Input::get('tag') as $tagid) {
         $company->tags()->attach($tagid);
     }
     $image = Input::file('photo');
     $filename = $company->id;
     $saveBigUrl = base_path() . '/public/images/companies/' . $filename . '.jpg';
     $saveMediumUrl = base_path() . '/public/images/companies/' . $filename . '_medium.jpg';
     $saveSmallUrl = base_path() . '/public/images/companies/' . $filename . '_small.jpg';
     Image::make($image->getRealPath())->fit(600, null, function ($constraint) {
         //for big image
         $constraint->upsize();
     })->save($saveBigUrl, 50)->fit(300)->save($saveMediumUrl, 50)->fit(100)->save($saveSmallUrl, 50);
     $company->big_image_url = url('images/companies/' . $filename . '.jpg');
     $company->medium_image_url = url('images/companies/' . $filename . '_medium.jpg');
     $company->small_image_url = url('images/companies/' . $filename . '_small.jpg');
     $company->save();
     return Response::json(array('success_code' => 'OK', 'data' => $company->toArray()), 201);
 }
开发者ID:rhalff,项目名称:vdragon-api,代码行数:40,代码来源:CompanyController.php

示例2: toArray

 /**
  * Convert to array
  * @return array
  */
 public function toArray()
 {
     $array = array('id_supplier' => $this->getIdSupplier(), 'id_payment_term' => $this->getIdPaymentTerm(), 'id_default_port' => $this->getIdDefaultPort(), 'id_company' => $this->getIdCompany(), 'id_invoice_address' => $this->getIdInvoiceAddress(), 'card_name' => $this->getCardName(), 'rfc' => $this->getRfc(), 'type_person' => $this->getTypePerson(), 'paydays' => $this->getPaydays(), 'id_currency' => $this->getIdCurrency(), 'id_final_grand_risk' => $this->getIdFinalGrandRisk(), 'id_approval_status' => $this->getIdApprovalStatus(), 'quality' => $this->getQuality(), 'consistency' => $this->getConsistency(), 'time' => $this->getTime(), 'type_supplier' => $this->getTypeSupplier());
     return array_merge(parent::toArray(), $array);
 }
开发者ID:Eximagen,项目名称:sochi,代码行数:9,代码来源:Supplier.php

示例3: toArray

 /**
  * Convert to array
  * @return array
  */
 public function toArray()
 {
     $array = array('id_forwarder' => $this->getIdForwarder(), 'id_company' => $this->getIdCompany(), 'name' => $this->getName(), 'last_fee' => $this->getLastFee(), 'status' => $this->getStatus(), 'status_name' => $this->getStatusName());
     return array_merge(parent::toArray(), $array);
 }
开发者ID:Eximagen,项目名称:sochi,代码行数:9,代码来源:Forwarder.php

示例4: toArray

 /**
  * Convert to array
  * @return array
  */
 public function toArray()
 {
     $array = array('id_customs_broker' => $this->getIdCustomsBroker(), 'id_company' => $this->getIdCompany(), 'id_last_fee_file' => $this->getIdLastFeeFile(), 'payment' => $this->getPayment(), 'status' => $this->getStatus(), 'status_name' => $this->getStatusName());
     return array_merge(parent::toArray(), $array);
 }
开发者ID:Eximagen,项目名称:sochi,代码行数:9,代码来源:CustomsBroker.php

示例5: createCompany

 /**
  * Create a new company
  *
  * @param Company $company
  *
  * @return array
  */
 public function createCompany($company)
 {
     return $this->post('companies', $company->toArray());
 }
开发者ID:k127,项目名称:donedone-api-php,代码行数:11,代码来源:Client.php


注:本文中的Company::toArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。