本文整理汇总了PHP中app\Company::toArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Company::toArray方法的具体用法?PHP Company::toArray怎么用?PHP Company::toArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Company
的用法示例。
在下文中一共展示了Company::toArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: anyEntry
public function anyEntry(Request $request, $id = null)
{
if (isset($id) && $id != null) {
$company = Company::find($id);
if ($company != null) {
session(['current_company' => $company->id]);
} else {
return redirect('companies');
}
} else {
$id = session('current_company') !== null ? session('current_company') : 0;
$address_id = session('current_address') !== null ? session('current_address') : 0;
if ($id) {
$company = Company::find($id);
session(["current_company" => $company->id]);
} else {
$company = Company::get()->last();
if ($company) {
session(["current_company" => $company->id]);
} else {
$company = new Company();
$company->save();
session(['current_company' => $company->id]);
}
}
}
$address = Address::where('module_id', '=', $company->id)->where('module_type', '=', 'App\\Company')->first();
$address_province = isset($address->province_id) ? $address->province_id : 0;
$country_province = Province::addSelect('provinces.name as province_name')->where('provinces.id', '=', $address_province)->addSelect('countries.name as country_name')->leftJoin('countries', 'countries.id', '=', 'provinces.country_id')->first();
if ($country_province) {
$country_province->toArray();
$company['province_name'] = $country_province['province_name'];
$company['country_name'] = $country_province['country_name'];
} else {
$company['province_name'] = '';
$company['country_name'] = '';
}
$countries = array();
$company_type = array();
$countries = Country::with('provinces')->get()->toArray();
$company_type = CompanyType::get()->toArray();
$company->toArray();
$this->layout->content = view('company.entry', ['company' => $company, 'address' => $address, 'countries' => $countries, 'company_type' => $company_type]);
}