lundi 21 octobre 2019

How to display rows of data with the same date through bootstrap collapse?

I'm trying to display data that are grouped by date. The view displays dates and should i click on it, all rows with the same date should be displayed. I'm quite lost on how to implement this feature.

Projects table

id | name | user_id | date_submitted

Controller

public function projectsList()
{
  $projects = DB::table('projects')
    ->select('id', 'name', 'user_id', 'date_submitted')
    ->groupBy('date_submitted')
    ->get();
  return view('teacher.projectsList', compact('projects'));
}  

View

<div class="accordion" id="datesubmitted">
 <div class="card">
  <div class="card-header" id="headingOne">
   <h2 class="mb-0">
    <button class="btn btn-link" type="button" data-toggle="collapse" data- 
      target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
        //This is where rows of the same data appear
        </button>
      </h2>
    </div>
 </div>
</div>   

I can display rows of data normally without it, but i'm stuck on how to integrate collapse/accordion to it. Any help would be appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire