Ignore:
Timestamp:
02/12/24 14:17:23 (9 months ago)
Author:
bube-ristovska <ristovska725@…>
Branches:
main
Children:
2bd3041
Parents:
92df8cd
Message:

Finalized phase 5

File:
1 edited

Legend:

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

    r92df8cd r7e9dadd  
    1717            return view('login');
    1818        }
    19         $results = DB::select('select * from policeman join people on policeman.pe_id = people.pe_id;');
     19        if(Session::get('is_policeman')){
     20            $police_station = DB::select('select * from police_station where p_id=:p_id;',['p_id'=>  Session::get('p_id')]);
     21        } else {
     22            $police_station = DB::select('select * from police_station where pe_id=:pe_id;',['pe_id'=>  Session::get('pe_id')]);
     23        }
     24        $results = DB::select('select * from policeman join people on policeman.pe_id = people.pe_id where p_id=:p_id;',['p_id'=>  $police_station[0]->p_id]);
     25//        $results = DB::select('select * from policeman join people on policeman.pe_id = people.pe_id;');
     26
    2027        return view('employees', [
    21             'employees' => $results
     28            'employees' => $results,
     29            'p_address'=>$police_station[0]->p_address
    2230        ]);
    2331    }
     
    3644        ]);
    3745
     46
     47        $police_station = DB::select('select * from police_station where pe_id=:pe_id;',['pe_id'=>  Session::get('pe_id')]);
     48
    3849        $pe_id = DB::select('select pe_id from people where embg = :embg;', ['embg' => $policeman["embg"]]);
    39         DB::insert('INSERT INTO policeman (pe_id, badge_no, p_date_of_employment, rank, p_id, p_password) VALUES (?, ?, ?, ?, ?, ?)', [$pe_id[0]->pe_id, $policeman["badge_no"], Carbon::now()->format('Y-m-d'), $policeman["rank"], $policeSTATION,$policeman["password"]]);
    40         return view('register-policeman');
     50        DB::insert('INSERT INTO policeman (pe_id, badge_no, p_date_of_employment, rank, p_id, p_password) VALUES (?, ?, ?, ?, ?, ?)', [$pe_id[0]->pe_id, $policeman["badge_no"], Carbon::now()->format('Y-m-d'), $policeman["rank"], $police_station[0]->p_id,$policeman["password"]]);
     51        return redirect()->back()->with('message',"Додадено");
    4152    }
    4253
Note: See TracChangeset for help on using the changeset viewer.