Ignore:
Timestamp:
04/22/24 20:14:54 (8 months ago)
Author:
bube-ristovska <ristovska725@…>
Branches:
main
Children:
249bf91
Parents:
5d9dd4e
Message:

Initial changes in database

File:
1 edited

Legend:

Unmodified
Added
Removed
  • app/Http/Controllers/CrimeCaseController.php

    r5d9dd4e rf7acd52  
    3333        $p_address = DB::select('select p_address from police_station where p_id=:p_id;',['p_id'=> $case[0]->p_id]);
    3434        $statements = DB::select('select * from statements where c_id=:c_id;',['c_id'=> $wildcard]);
    35         $evidence = DB::select('select * from evidence_of_case where c_id=:c_id;',['c_id'=> $wildcard]);
     35
     36
    3637        $victims=[];
    3738        $witness=[];
     39        $evidence_id = [];
     40        $evidence = [];
     41        foreach ($statements as $statement) {
     42            $evidence_id = DB::select('select * from mentions_evidence where s_id=:s_id;',['s_id'=> $statement->s_id]);
     43            if (!empty($evidence_id)) { // Check if $evidence_id is not empty
     44                $evidence_id[] = $evidence_id[0];
     45            }
     46        }
     47         $evidence_id=collect($evidence_id)->unique();
     48        foreach ($evidence_id as $e) {
     49            $evidence = DB::select('select * from evidence where e_id=:e_id;',['e_id'=> $e->e_id]);
     50            $evidence[] = $evidence[0];
     51        }
    3852        foreach ($statements as $st){
    3953            $victim=DB::select('select * from people where pe_id=:pe_id;',['pe_id'=> $st->victim_pe_id]);
Note: See TracChangeset for help on using the changeset viewer.