当前位置: 首页>>代码示例>>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;未经允许,请勿转载。