0
2つの日付の範囲を適用してデータベースから行をフェッチしようとしています。開始および終了laravelの日付範囲から行を取得する
これはテストデータです。
Collection {#258 ▼
#items: array:4 [▼
0 => Customer_history {#237 ▶}
1 => Customer_history {#260 ▶}
2 => Customer_history {#261 ▶}
3 => Customer_history {#262 ▼
#attributes: array:12 [▼
"ch_id" => 1
"customer_id" => 1
"invoice_id" => 12
"created_at" => "2017-07-17 22:57:55"
"updated_at" => "2017-07-17 22:57:55"
"branch_id" => 1
"salesman_id" => 1
"remarks" => ""
"invoice_no" => ""
"advance" => ""
"is_delivered" => 1
"is_paid" => 1
]
}
]
}
あなたは、私が2日付でクエリを適用したときに今の日付2017-07-17
を持っている1 2これは任意の行を返さないと、それはリターン1行を持っている必要があり
$from = date_create("2017-07-17");
$till = date_create("2017-07-17");
$customer_histories = Customer_history::leftJoin('invoices AS i', 'i.invoice_id', 'customer_histories.invoice_id')
->where('is_paid','=',1)
->whereBetween('customer_histories.created_at', [$from,$till])
->get();
を作成したがある見たよう!私は何かを逃していると思う。誰かが私を助けて、それを機能させるために省略したり修正したりすべきことはできますか?
感謝を入れて!出来た :) – Alen