Changeset d9c4096 for app/Http/Controllers
- Timestamp:
- 02/10/24 17:58:54 (11 months ago)
- Branches:
- main
- Children:
- 92df8cd
- Parents:
- 6dec591
- Location:
- app/Http/Controllers
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
app/Http/Controllers/CrimeCaseController.php
r6dec591 rd9c4096 9 9 { 10 10 function cases(){ 11 if(Session::get('pe_id') == null) { 12 return view('login'); 13 } 11 14 12 $police_station= DB::select('select * from police_station where pe_id=:pe_id;',['pe_id'=> Session::get('pe_id')]); 15 16 if(Session::get('is_policeman')){ 17 $police_station = DB::select('select * from police_station where p_id=:p_id;',['p_id'=> Session::get('p_id')]); 18 } else { 19 $police_station = DB::select('select * from police_station where pe_id=:pe_id;',['pe_id'=> Session::get('pe_id')]); 20 } 21 13 22 $cases = DB::select('select * from crime_case where p_id=:p_id;',['p_id'=> $police_station[0]->p_id]); 14 23 24 15 25 return view('cases', [ 16 'cases' => $cases 26 'cases' => $cases, 27 'p_address'=>$police_station[0]->p_address 17 28 ]); 18 29 19 30 } 20 function case(){ 21 return view('case'); 31 function case($wildcard){ 32 $case = DB::select('select * from crime_case where c_id=:c_id;',['c_id'=> $wildcard]); 33 $p_address = DB::select('select p_address from police_station where p_id=:p_id;',['p_id'=> $case[0]->p_id]); 34 $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]); 36 return view('case', [ 37 'case' => $case[0], 38 'p_address'=>$p_address[0]->p_address, 39 'statements'=>$statements, 40 'evidence'=>$evidence, 41 ]); 22 42 } 23 43 } -
app/Http/Controllers/OfficerController.php
r6dec591 rd9c4096 7 7 use Illuminate\Http\Request; 8 8 use Illuminate\Support\Facades\DB; 9 use Illuminate\Support\Facades\Session; 9 10 10 11 class OfficerController extends Controller … … 12 13 function employees() 13 14 { 15 if(Session::get('pe_id') == null) { 16 return view('login'); 17 } 14 18 $results = DB::select('select * from policeman join people on policeman.pe_id = people.pe_id;'); 15 19 return view('employees', [ -
app/Http/Controllers/PeopleController.php
r6dec591 rd9c4096 5 5 use Illuminate\Http\Request; 6 6 use Illuminate\Support\Facades\DB; 7 use Illuminate\Support\Facades\Session; 7 8 8 9 class PeopleController extends Controller 9 10 { 10 11 function filter(){ 12 if(Session::get('pe_id') == null) { 13 return view('login'); 14 } 11 15 $peoples = DB::select('select * from people;'); 12 16 … … 16 20 } 17 21 function filter_post(){ 22 if(Session::get('pe_id') == null) { 23 return view('login'); 24 } 18 25 $credentials = request()->validate([ 19 26 'embg' => 'required' … … 27 34 ]); 28 35 } 36 function get_person($embg){ 37 $person = DB::select('SELECT * FROM people WHERE embg=:embg', ['embg' => $embg]); 38 dd($person); 39 return view('register-policeman', [ 40 'person' => $person[0] 41 ]); 42 } 29 43 } -
app/Http/Controllers/SessionsController.php
r6dec591 rd9c4096 28 28 } 29 29 if($exists == null) { 30 return back()->withErrors(['badge_no' => 'Invalid credentials']);30 return back()->withErrors(['badge_no' => 'Invalid badge_no']); 31 31 } 32 32 … … 41 41 Session::put('badge_no', $badge_no); 42 42 Session::put('is_policeman', $policeman); 43 Session::put('pe_id', $exists[0]->pe_id); 43 if($policeman){ 44 Session::put('p_id', $exists[0]->p_id); 45 } else { 46 Session::put('pe_id', $exists[0]->pe_id); 47 } 44 48 return redirect()->intended('/'); 45 49 }
Note:
See TracChangeset
for help on using the changeset viewer.