これはコントローラである:ここ変換アレイ
public function paidCount($booking_id) {
$book = \App\ EventBookings::where('booking_id', '=', $booking_id) - > get();
if ($book - > count() > 0) {
$cha = \App\ EventBookingCharges::where('booking_id', '=', $book[0] - > booking_id) - > where('charge_key', 'LIKE', 'contribution') - > where('status', 'LIKE', '1') - > get();
if ($cha - > count() > 0) {
$meta = \App\ EventBookingsMeta::where('booking_id', '=', $cha[0] - > booking_id) - > where('meta_key', 'LIKE', 'used_coupon') - > value('meta_value');
if ($meta - > count() > 0) {
return\ App\ Coupon::where('coupon_id', '=', $meta[0] - > coupon_id) - > increment('no_paid');
}
}
}
}
この部分は問題です:私のデータベース内
$meta = \App\EventBookingsMeta::where('booking_id', '=', $cha[0]->booking_id)->where('meta_key', 'LIKE', 'used_coupon')->value('meta_value');
if ($meta->count() > 0) {
return \App\Coupon::where('coupon_id', '=', $meta[0]->coupon_id)->increment('no_paid');
meta_value
ので、これはそれが見え、まさに配列です行の内側のようなものused_coupon
used_coupon [1] used_coupon 210又は
[1、2、3]
($meta->count() > 0)
習慣を整数として、それがエラーの原因となるように読めばザ。
'count($ meta-> toArray())> 0'を試してください。配列を文字列に変換したい場合は、 'implode(" "、$ meta);' –
@BalrajAllam私はそれを取得しないと申し訳ありません。私はこれに新しいです:D –
あなたのエラーは?あなたは何を達成したいですか? –