There is such a table of reports by dates.
Using the query (in the model)
$query = DB::select('id', 'date', 'content', array(DB::expr('year(`date`)'), 'year')) ->from('reports') ->where('activity_id', '=', $ID) ->order_by('date', 'DESC');
Got data
But now I need to output them to a template, this way
Those. create a list in which “year” needs to be output only once to all reports created in a particular year. Cycle <?php foreach($list_reports as $key => $list_report):?>
I can <?php foreach($list_reports as $key => $list_report):?>
and output, only it turns out to display a year for each article.
The question is whether you need to redo the query itself or the resulting array?
date
)'), 'year') ) is already there. Now the task , in view, is to display it only once - Konstantin78