Ignore:
Timestamp:
08/26/24 16:17:04 (4 months ago)
Author:
bube-ristovska <ristovska725@…>
Branches:
main
Parents:
5372778
Message:

Refactored duplicate code

File:
1 edited

Legend:

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

    r5372778 r3c89e27  
    1313            return view('login');
    1414        }
    15         $peoples = DB::select('select * from people;');
    16 
     15        $peoples = DB::table('people')->get();
    1716        return view('filter', [
    1817            'peoples' => $peoples
     
    7574    {
    7675        $embg = $request->input('embg');
    77         $person = DB::select('SELECT * FROM people WHERE embg = :embg', ['embg' => $embg]);
    78 
     76        $person = DB::table('people')
     77            ->where('embg', $embg)->get();
    7978        return response()->json($person[0] ?? null);
    8079    }
Note: See TracChangeset for help on using the changeset viewer.