本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例5: createCompany
/**
* Create a new company
*
* @param Company $company
*
* @return array
*/
public function createCompany($company)
{
return $this->post('companies', $company->toArray());
}