本文整理汇总了PHP中app\Address::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Address::select方法的具体用法?PHP Address::select怎么用?PHP Address::select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Address
的用法示例。
在下文中一共展示了Address::select方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: anyExportExcel
public function anyExportExcel(){
$id_template = 5;
$arr_print = [
'arr_list' => [
'arr_key' => [
'sku',
'name',
'oum_name',
'specification',
'quantity',
'sell_price',
'amount'
],
'arr_head' => [
['text'=>'STT','class'=>''],
['text'=>'Mã','class'=>''],
['text'=>'Tên sản phẩm','class'=>''],
['text'=>'Đơn vị','class'=>'center'],
['text'=>'Quy cách','class'=>'center'],
['text'=>'Số lượng','class'=>'center'],
['text'=>'Đơn giá','class'=>'money'],
['text'=>'Thành tiền','class'=>'money']
],
'arr_body'=>[],
'arr_sum'=>[]
],
'arr_data'=> [
'id'=>session('current_saleorder')
]
];
if (\Cache::has('list_product_so'.\Auth::user()->id)){
$so = Saleorder::select('saleorders.*','companies.name')
->where('saleorders.id','=',session('current_saleorder'))
->leftJoin('companies','companies.id','=','saleorders.company_id')->get()->first();
$month = intval(date('m',strtotime($so->date)));
$year = intval(date('Y',strtotime($so->date)));
$begin = date('Y-m-d H:i:s',strtotime('1'.'-'.$month.'-'.$year));
$end = $so->date;
$list_order = array();
$key_order = 1;
$arr_print['arr_data']['date'] = date('d-m-Y',strtotime($so->date));
$arr_print['arr_data']['company_name'] = $so->name;
$arr_print['arr_data']['phone'] = $so->company_phone;
$arr_print['arr_data']['address'] = '';
$arr_dress = Address::select('addresses.*','provinces.name as province_name')
->where('addresses.id','=',$so->address_id)
->leftJoin('provinces','provinces.id','=','addresses.province_id')
->get()->first();
$arr_print['arr_data']['address'] .= $arr_dress->address?$arr_dress->address.', ':'';
$arr_print['arr_data']['address'] .= $arr_dress->town_city?$arr_dress->town_city.', ':'';
$arr_print['arr_data']['address'] .= $arr_dress->province_name?$arr_dress->province_name:'';
$receipt_month_prev = ReceiptMonth::where('type_receipt','=','customer')
->where('company_id','=',$so->company_id)
->where(function($query) use ($month,$year){
$query->where(function($query2) use ($month,$year){
$query2->where('month','<',$month)
->where('year','=',$year);
})->orWhere(function($query2) use ($month,$year){
$query2->where('year','<',$year);
});
})
->orderBy('year','desc')
->orderBy('month','desc')
->limit(1);
$receipt_month_prev = $receipt_month_prev->first();
if($receipt_month_prev){
$arr_print['arr_data']['no_cu'] = $receipt_month_prev->con_lai;
}else{
$arr_print['arr_data']['no_cu'] = 0;
}
$list_po = Saleorder::where('date','>=',$begin)
->where('date','<',$end)
->where('status','=',1)
->where('company_id','=',$so->company_id)
->get()->toArray();
foreach ($list_po as $key => $value) {
$list_order[$key_order]['id'] = $value['id'];
$list_order[$key_order]['date'] = $value['date'];
$list_order[$key_order]['sum_amount'] = $value['sum_amount'];
$key_order++;
}
$list_so = ReturnSaleorder::where('date','>=',$begin)
->where('date','<',$end)
->where('status','=',1)
->where('company_id','=',$so->company_id)
->get()->toArray();
foreach ($list_so as $key => $value) {
$list_order[$key_order]['id'] = $value['id'];
$list_order[$key_order]['date'] = $value['date'];
$list_order[$key_order]['sum_amount'] = -$value['sum_amount'];
$key_order++;
}
$list_paid = Paid::where('date','>=',$begin)
->where('date','<',$end)
->where('company_id','=',$so->company_id)
->where('type_paid','=','customer')
//.........这里部分代码省略.........
示例2: anyExportPdf
public function anyExportPdf(){
$id_template = 3;
$arr_print = [
'arr_list' => [
'arr_key' => [
'sku',
'name',
'oum_name',
'specification',
'quantity',
'origin_price',
'invest'
],
'arr_head' => [
['text'=>'Mã','class'=>''],
['text'=>'Tên sản phẩm','class'=>''],
['text'=>'Đơn vị','class'=>'center'],
['text'=>'Quy cách','class'=>'center'],
['text'=>'Số lượng','class'=>'center'],
['text'=>'Đơn giá','class'=>'money'],
['text'=>'Thành tiền','class'=>'money']
],
'arr_body'=>[],
'arr_sum'=>[]
],
'arr_data'=> [
'id'=>session('current_returnpurchaseorder')
]
];
if (\Cache::has('list_product_rpo'.\Auth::user()->id)){
$rpo = ReturnPurchaseorder::select('return_purchaseorders.*','companies.name')->where('return_purchaseorders.id','=',session('current_returnpurchaseorder'))
->leftJoin('companies','companies.id','=','return_purchaseorders.company_id')->get()->first();
$month = intval(date('m',strtotime($rpo->date)));
$year = intval(date('Y',strtotime($rpo->date)));
$begin = date('Y-m-d H:i:s',strtotime('1'.'-'.$month.'-'.$year));
$end = $rpo->date;
$list_order = array();
$key_order = 1;
$arr_print['arr_data']['date'] = date('d-m-Y',strtotime($rpo->date));
$arr_print['arr_data']['company_name'] = $rpo->name;
$arr_print['arr_data']['phone'] = $rpo->company_phone;
$arr_print['arr_data']['address'] = '';
$arr_dress = Address::select('addresses.*','provinces.name as province_name')
->where('addresses.id','=',$rpo->address_id)
->leftJoin('provinces','provinces.id','=','addresses.province_id')
->get()->first();
$arr_print['arr_data']['address'] .= $arr_dress->address?$arr_dress->address.', ':'';
$arr_print['arr_data']['address'] .= $arr_dress->town_city?$arr_dress->town_city.', ':'';
$arr_print['arr_data']['address'] .= $arr_dress->province_name?$arr_dress->province_name:'';
$receipt_month_prev = ReceiptMonth::where('type_receipt','=','distribute')
->where('company_id','=',$rpo->company_id)
->where(function($query) use ($month,$year){
$query->where(function($query2) use ($month,$year){
$query2->where('month','<',$month)
->where('year','=',$year);
})->orWhere(function($query2) use ($month,$year){
$query2->where('year','<',$year);
});
})
->orderBy('year','desc')
->orderBy('month','desc')
->limit(1);
$receipt_month_prev = $receipt_month_prev->first();
if($receipt_month_prev){
$arr_print['arr_data']['no_cu'] = $receipt_month_prev->con_lai;
}else{
$arr_print['arr_data']['no_cu'] = 0;
}
$list_po = Purchaseorder::where('date','>=',$begin)
->where('date','<',$end)
->where('status','=',1)
->where('company_id','=',$rpo->company_id)
->get()->toArray();
foreach ($list_po as $key => $value) {
$list_order[$key_order]['id'] = $value['id'];
$list_order[$key_order]['date'] = $value['date'];
$list_order[$key_order]['sum_amount'] = $value['sum_amount'];
$key_order++;
}
$list_rpo = ReturnPurchaseorder::where('date','>=',$begin)
->where('date','<',$end)
->where('status','=',1)
->where('company_id','=',$rpo->company_id)
->get()->toArray();
foreach ($list_rpo as $key => $value) {
$list_order[$key_order]['id'] = $value['id'];
$list_order[$key_order]['date'] = $value['date'];
$list_order[$key_order]['sum_amount'] = -$value['sum_amount'];
$key_order++;
}
$list_paid = Paid::where('date','>=',$begin)
->where('date','<',$end)
->where('company_id','=',$rpo->company_id)
->where('type_paid','=','distribute')
->get()->toArray();
//.........这里部分代码省略.........
示例3: getAddressByCompanyId
public static function getAddressByCompanyId($company_id)
{
return Address::select('id', 'address', 'zip_postcode', 'town_city', 'module_id', 'module_type', 'province_id', 'country_id')->where('module_type', '=', 'App\\Company')->where('module_id', '=', $company_id)->first();
}