Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rafaeladi's avatar

Stored session data on query

hi so i stored the data on my session but i want to implement it like a filter. So instead of showing all data from my query, i want to filter some attribute with the data stored in my session. How do i do such things? since the query is separated from the controller itself? Currently i have this

public function testSuiteDetails($suite_id)
{
return DB::table('test_executions as e')
    ->select('b.branch as build_name','e.case_id','b.version','cf.config','c.name as case',DB::raw('SUM(distinct e.duration) as time'))
    ->selectRaw('COUNT(e.verdict) as totalverdict')
    ->selectRaw('SUM(e1.verdict) as verdict2')
    ->join('test_executions as e1','e1.id','=','e.id')
    ->rightJoin('test_cases as c','e.case_id','=','c.id')
    ->rightJoin('test_suites as s','c.suite_id','=','s.id')
    ->rightJoin('build_versions as b','e.build_id','=','b.id')
    ->rightJoin('config_3 as cf','e.finalconfig_id','=','cf.id')
    ->groupBy('e.case_id','b.version','c.name','cf.config')
    ->where('c.suite_id',$suite_id)
    ->get();
}

and the stored data is derived from this dropdown on my main page

<form class="row g-3">
  <div class="col-auto">
    <label for="choose_build" class="col-form-label fw-bold">Choose Build:</label>
  </div>
  <div class="col-auto align-middle">
    <select class="form-select" id="build_list" name="build_list">
      <option>Pick from the repo</option>
      <option value="Master">Master</option>
      <option value="Nightly">Nightly</option>
      <option value="Release">Release</option>
      </select>
  </div>
  <div class="col-auto">
    <button type="submit" class="btn btn-primary mb-3">Confirm Select</button>
  </div>
</form>

And i want the data from the session acts like another where statement in my query, how do i do that?

0 likes
0 replies

Please or to participate in this conversation.