Changeset 92df8cd for app/Http/Controllers
- Timestamp:
- 02/11/24 18:29:24 (11 months ago)
- Branches:
- main
- Children:
- 7e9dadd
- Parents:
- d9c4096
- Location:
- app/Http/Controllers
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
app/Http/Controllers/OfficerController.php
rd9c4096 r92df8cd 6 6 use Illuminate\Contracts\Auth\Authenticatable; 7 7 use Illuminate\Http\Request; 8 use Illuminate\Support\Carbon; 8 9 use Illuminate\Support\Facades\DB; 9 10 use Illuminate\Support\Facades\Session; … … 26 27 return view('register-policeman'); 27 28 } 29 function register_post() 30 { 31 $policeman = request()->validate([ 32 'badge_no' => 'required', 33 'embg' => 'required', 34 'password' => 'required', 35 'rank'=>'required' 36 ]); 37 38 $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'); 41 } 28 42 29 43 -
app/Http/Controllers/PeopleController.php
rd9c4096 r92df8cd 34 34 ]); 35 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 ]);36 public function getPerson(Request $request) 37 { 38 $embg = $request->input('embg'); 39 $person = DB::select('SELECT * FROM people WHERE embg = :embg', ['embg' => $embg]); 40 41 return response()->json($person[0] ?? null); 42 42 } 43 43 }
Note:
See TracChangeset
for help on using the changeset viewer.