У меня есть две таблицы и их модели, названные Attendance и Line, я пытаюсь получить все из «посещаемости», которая группируется по line_id и упорядочивается по именам строк
вот часть того, что я пробовал
public function lineWiseReport(Attendance $attendance){
$repository = $this->repository;
if(Input::has('date')){
$date = Input::get('date');
$attn->where('date','like','%'.$date.'%');
$attendances = $attn
->where('employee_type_id',2)
->orderBy('lines.name', 'ASC') //how to do this?
->get()->groupBy('line_id');
}else{
$date = '';
$attendances = [];
}
}
class Attendance extends Model
{
public function line()
{
return $this->belongsTo(Line::class);
}
}
Теперь я получаю только группу по line_id, но я хочу, чтобы она сортировалась как строка A, строка B, строка C в порядке возрастания.