當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Company::toArray方法代碼示例

本文整理匯總了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]);
 }
開發者ID:kamitori,項目名稱:khuongnhi2,代碼行數:44,代碼來源:CompaniesController.php


注:本文中的app\Company::toArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。