Ignore:
Timestamp:
06/05/24 13:35:43 (7 months ago)
Author:
bube-ristovska <ristovska725@…>
Branches:
main
Children:
768f473
Parents:
f7acd52
Message:

New feature - details for employee

Location:
app/Http/Controllers
Files:
3 edited

Legend:

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

    rf7acd52 r249bf91  
    2828        ]);
    2929
     30    }
     31    function register_statement(){
     32        return view('register-statement');
     33    }
     34    function register_statement_post()
     35    {
     36       //TODO: so kiki i bojan vodete se po logikata na add policeman
     37    }
     38    function finished_cases(){
     39
     40        if(Session::get('is_policeman')){
     41            $police_station = DB::select('select * from police_station where p_id=:p_id;',['p_id'=>  Session::get('p_id')]);
     42        } else {
     43            $police_station = DB::select('select * from police_station where pe_id=:pe_id;',['pe_id'=>  Session::get('pe_id')]);
     44        }
     45
     46        $cases = DB::select('select * from crime_case where p_id=:p_id and c_status=\'Z\';', ['p_id' => $police_station[0]->p_id]);
     47
     48        return view('archive', [
     49            'cases' => $cases,
     50            'p_address'=>$police_station[0]->p_address
     51        ]);
    3052    }
    3153    function case($wildcard){
  • app/Http/Controllers/OfficerController.php

    rf7acd52 r249bf91  
    3131    }
    3232
     33    function show($id){
     34        if(Session::get('is_policeman')){
     35            $police_station = DB::select('select * from police_station where p_id=:p_id;',['p_id'=>  Session::get('p_id')]);
     36        } else {
     37            $police_station = DB::select('select * from police_station where pe_id=:pe_id;',['pe_id'=>  Session::get('pe_id')]);
     38        }
     39        $result = DB::select('select * from policeman join people on policeman.pe_id = people.pe_id where p_id=:p_id and people.pe_id=:pe_id;',['p_id'=>  $police_station[0]->p_id, 'pe_id' => $id]);
     40        $cases = DB::select('select * from statements where pe_id=:pe_id;',['pe_id' => $id]);
     41
     42        return view('employee', [
     43            'employee' => $result[0],
     44            'p_address'=>$police_station[0]->p_address,
     45            'cases' => $cases
     46        ]);
     47    }
     48
    3349    function register()
    3450    {
  • app/Http/Controllers/SessionsController.php

    rf7acd52 r249bf91  
    4242            Session::put('is_policeman', $policeman);
    4343            if($policeman){
    44                 Session::put('p_id', $exists[0]->p_id);
     44                Session::put('pe_id', $exists[0]->p_id);
    4545            } else {
    4646                Session::put('pe_id', $exists[0]->pe_id);
Note: See TracChangeset for help on using the changeset viewer.