Я не знаю, какую ценность вы здесь передаете.
$today->month
Вместо этого $ сегодня-> месяц вы должны указать здесь точный месяц
Пожалуйста, попробуйте это
$indebted = DB::table('students')->where('students.active',1)
->leftJoin('payments', 'students.id', '=', 'payments.user_id')
->whereMonth('payments.created_at','=', 06)
->get();
In this case it's easier to split on the delimiters (commas) than to match the tokens (or chunks). Identifying the commas that are delimiters takes a relatively simple lookahead:
,(?=[^\]]*(?:\[|$))
Each time you find a comma, you do a lookahead for one of three things. If you find a closing square bracket first, the comma is inside a pair of brackets, so it's not a delimiter. If you find an opening bracket or the end of the line/string, it's a delimiter.
Вариации этого вопроса уже обсуждались ранее.
Например:
Краткий ответ: Регулярные выражения, вероятно, не являются подходящим инструментом для этого. Напишите правильный парсер. Реализация FSM проста .
(?<=,|^)\s*\[[^]]*\]\s*(?=,|$)
используйте разделители [
и ]
в ваших интересах
You could either use a regular expression to match the values inside the brackets:
\[[^\]*]\]
Or you use this regular expression to split the bracket list (using look-around assertions):
(?<=]|^)\s*,\s*(?=\[|$)