本文整理汇总了PHP中app\Company::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Company::select方法的具体用法?PHP Company::select怎么用?PHP Company::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Company
的用法示例。
在下文中一共展示了Company::select方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
public function store(ContactFormRequest $request)
{
$company = Company::select('contact_email', 'sales_email', 'support_email', 'website_name')->find(1)->toArray();
$from_address = $company[$request->get('type_of_request') . '_email'];
$name = $request->get('name');
$email = $request->get('email');
$message_ = $request->get('message');
$title = trans('company.email_title_' . $request->get('type_of_request'));
$thanks = trans('company.email_thanks_' . $request->get('type_of_request'));
return view('emails.contact', compact('thanks', 'title', 'name', 'email', 'message_'));
\Mail::send('emails.contact', compact('thanks', 'title', 'name', 'email', 'message_'), function ($message) use($request, $company, $from_address, $email) {
$message->from($from_address, $company['website_name']);
$message->to($email)->cc($from_address)->subject(trans('about.contact') . ' :: ' . $company['website_name']);
});
return \Redirect::route('contact')->with('message', $thanks);
}
示例2: listAll
public static function listAll()
{
return Company::select('id', 'name')->get();
}
示例3: anyList
public function anyList(Request $request)
{
if ($request->has('input-sort')) {
$arr_sort = $request->input('input-sort');
$arr_sort = (array) json_decode($arr_sort);
} elseif (session('sort_filter_company.arr_sort') !== null) {
$arr_sort = session('sort_filter_company.arr_sort');
} else {
$arr_sort = array();
}
session('sort_filter_company.arr_sort', $arr_sort);
if ($request->has('input-filter')) {
$arr_filter = $request->input('input-filter');
} elseif (session('sort_filter_company.arr_filter') !== null) {
$arr_filter = session('sort_filter_company.arr_filter');
} else {
$arr_filter = ['name' => '', 'province_id' => ''];
}
session(['sort_filter_company.arr_sort' => $arr_sort]);
session(['sort_filter_company.arr_filter' => $arr_filter]);
//Init array
$list_provinces = Province::get()->toArray();
//Get value array
$list_all_companies = Company::select('id', 'name')->get()->toArray();
$list_company = Company::select('companies.*', 'addresses.*', 'provinces.name as province_name')->leftJoin('addresses', function ($join) {
$join->on("companies.id", "=", "addresses.module_id")->where('module_type', '=', 'App\\Company');
});
$list_company->addSelect('provinces.name as province_name')->leftJoin('provinces', function ($join) {
$join->on("addresses.province_id", "=", "provinces.id");
});
foreach ($arr_sort as $key => $value) {
if ($key == 'id') {
$list_company->orderBy('companies.id', $value);
} elseif ($key == 'phone') {
$list_company->orderBy('companies.phone', $value);
} elseif ($key == 'address') {
$list_company->orderBy('addresses.address', $value);
} elseif ($key == 'town_city') {
$list_company->orderBy('addresses.town_city', $value);
} elseif ($key == 'province_name') {
$list_company->orderBy('provinces.name', $value);
} else {
$list_company->orderBy($key, $value);
}
}
if (!count($arr_sort)) {
$list_company->orderBy('companies.name', 'asc');
}
if ($arr_filter['name'] != '') {
$list_company->where('companies.name', $arr_filter['name']);
} else {
foreach ($arr_filter as $key => $value) {
if ($value != '') {
$list_company->where($key, $value);
}
}
}
$list_company = $list_company->paginate(50);
$this->layout->content = view('company.list', ['list_company' => $list_company, 'list_all_companies' => $list_all_companies, 'arr_sort' => $arr_sort, 'arr_filter' => $arr_filter, 'list_provinces' => $list_provinces]);
}