Ignore:
Timestamp:
02/11/24 18:29:24 (9 months ago)
Author:
bube-ristovska <ristovska725@…>
Branches:
main
Children:
7e9dadd
Parents:
d9c4096
Message:

Add policeman

File:
1 edited

Legend:

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

    rd9c4096 r92df8cd  
    66use Illuminate\Contracts\Auth\Authenticatable;
    77use Illuminate\Http\Request;
     8use Illuminate\Support\Carbon;
    89use Illuminate\Support\Facades\DB;
    910use Illuminate\Support\Facades\Session;
     
    2627        return view('register-policeman');
    2728    }
     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    }
    2842
    2943
Note: See TracChangeset for help on using the changeset viewer.