Ignore:
Timestamp:
02/08/24 16:15:01 (11 months ago)
Author:
bube-ristovska <ristovska725@…>
Branches:
main
Children:
6dec591
Parents:
6b10b67
Message:

Added querries half done

File:
1 edited

Legend:

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

    r6b10b67 rcf84baa  
    44
    55use Illuminate\Http\Request;
     6use Illuminate\Support\Facades\DB;
    67
    78class PeopleController extends Controller
    89{
    910    function filter(){
    10         return view('filter');
     11        $peoples = DB::select('select * from people;');
     12
     13        return view('filter', [
     14            'peoples' => $peoples
     15        ]);
     16    }
     17    function filter_post(){
     18        $credentials = request()->validate([
     19            'embg' => 'required'
     20        ]);
     21        $embg = $credentials['embg'];
     22
     23        $peoples = DB::select('SELECT * FROM people WHERE embg ~ :embg', ['embg' =>  '^' . $embg]);
     24
     25        return view('filter', [
     26            'peoples' => $peoples
     27        ]);
    1128    }
    1229}
Note: See TracChangeset for help on using the changeset viewer.