1
我搜索網,但我無法找到解決我的問題, 我是一個笨開發商,現在我在Laravel如何在Laravel 4中編寫此查詢?
我的笨活動記錄查詢,這樣啓動了一個項目:
public function show_brt($id = 0,$tax_cat_id,$lang="en")
{
$records = $this->db
->select('
t1.id,
t1.date_received,
t1.customer_name,
t1.memo,
t1.percent_tax_withheld,
t1.gross_invoice_amount,
t1.tax_amount_withheld,
t1.net_amount_received,
t1.tax_payment_date,
t2.rate,
t3.name_' . $lang. ' AS deposit_account'
)
->from('brt AS t1')
->join('exchange_rate AS t2', 't2.id = t1.exchange_rate_id','left')
->join('balance_sheet_accounts AS t3', 't3.id = t1.deposit_account_id','left')
->where('t1.income_statement_account_id', $id)
->where('t1.tax_cat_id',$tax_cat_id)
->where('t1.company_id', $this->session->userdata('company_id'))
->where('t1.fiscal_year_id', $this->session->userdata('fiscal_year_id'))
->where('t1.user_id', $this->m_auth->get_user_id())
->get();
if ($records->num_rows() > 0) {
return $records;
}
}
任何人都可以幫助我,我該如何寫這樣的查詢,這應該是從Laravel Eloquent或Fluent的sql注入安全。