source: app/Http/Controllers/PeopleController.php@ d9c4096

main
Last change on this file since d9c4096 was d9c4096, checked in by bube-ristovska <ristovska725@…>, 9 months ago

Bug with embg

  • Property mode set to 100644
File size: 1.1 KB
Line 
1<?php
2
3namespace App\Http\Controllers;
4
5use Illuminate\Http\Request;
6use Illuminate\Support\Facades\DB;
7use Illuminate\Support\Facades\Session;
8
9class PeopleController extends Controller
10{
11 function filter(){
12 if(Session::get('pe_id') == null) {
13 return view('login');
14 }
15 $peoples = DB::select('select * from people;');
16
17 return view('filter', [
18 'peoples' => $peoples
19 ]);
20 }
21 function filter_post(){
22 if(Session::get('pe_id') == null) {
23 return view('login');
24 }
25 $credentials = request()->validate([
26 'embg' => 'required'
27 ]);
28 $embg = $credentials['embg'];
29
30 $peoples = DB::select('SELECT * FROM people WHERE embg ~ :embg', ['embg' => '^' . $embg]);
31
32 return view('filter', [
33 'peoples' => $peoples
34 ]);
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 }
43}
Note: See TracBrowser for help on using the repository browser.