Index: app/Http/Controllers/CrimeCaseController.php
===================================================================
--- app/Http/Controllers/CrimeCaseController.php	(revision 249bf91ed01b2668de0b85629744c0ae1c0ba930)
+++ app/Http/Controllers/CrimeCaseController.php	(revision 092fcda5a2f36c7ffda321a50fac25284a159d9c)
@@ -3,4 +3,5 @@
 namespace App\Http\Controllers;
 
+use Carbon\Carbon;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\DB;
@@ -34,5 +35,51 @@
     function register_statement_post()
     {
-       //TODO: so kiki i bojan vodete se po logikata na add policeman
+        $role = request()->input('role');
+
+
+        $statement = request()->validate([
+            'embg' => 'required',
+            'description' => 'required',
+            'incident_timestamp' => 'required',
+            'incident_place'=>'required'
+        ]);
+        $statement["statement_date"] = Carbon::now()->format('Y-m-d');
+        $covek = DB::select('select pe_id from people where embg=:embg;',['embg'=> $statement["embg"]]);
+         $s_id_b = DB::select('select MAX(s_id) from statements');
+         $s_id = $s_id_b[0]->max;
+        $s_id = $s_id +1 ;
+        $policaec =  DB::select('select pe_id from policeman where badge_no=:badge_no;',['badge_no'=> Session::get("badge_no")]);
+
+        if ($role === 'witness') {
+            DB::insert('INSERT INTO statements (s_id, statement_date, description, incident_timestamp, incident_place, c_id, pe_id, victim_pe_id, witness_pe_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)',
+                [
+                    $s_id,
+                    $statement["statement_date"],
+                    $statement["description"],
+                    $statement["incident_timestamp"],
+                    $statement["incident_place"],
+                    Session::get("c_id"),
+                    $policaec[0]->pe_id,
+                    NULL,
+                    $covek[0]->pe_id
+
+                ]);
+        } elseif ($role === 'victim') {
+            DB::insert('INSERT INTO statements (s_id, statement_date, description, incident_timestamp, incident_place, c_id, pe_id, victim_pe_id, witness_pe_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)',
+                [
+                    $s_id,
+                    $statement["statement_date"],
+                    $statement["description"],
+                    $statement["incident_timestamp"],
+                    $statement["incident_place"],
+                    Session::get("c_id"),
+                    $policaec[0]->pe_id,
+                    $covek[0]->pe_id,
+                    NULL
+                ]);
+        }
+        return redirect()->route('case', ['wildcard' =>  Session::get("c_id"),]);
+
+
     }
     function finished_cases(){
@@ -52,4 +99,5 @@
     }
     function case($wildcard){
+        Session::put('c_id', $wildcard);
         $case = DB::select('select * from crime_case where c_id=:c_id;',['c_id'=> $wildcard]);
         $p_address = DB::select('select p_address from police_station where p_id=:p_id;',['p_id'=> $case[0]->p_id]);
@@ -73,11 +121,16 @@
         }
         foreach ($statements as $st){
-            $victim=DB::select('select * from people where pe_id=:pe_id;',['pe_id'=> $st->victim_pe_id]);
-            $victims[] = $victim[0];
+            if (!($st->victim_pe_id)==NULL){
+                $victim=DB::select('select * from people where pe_id=:pe_id;',['pe_id'=> $st->victim_pe_id]);
+                $victims[] = $victim[0];
+            }
         }
         foreach ($statements as $st){
-            $witnes=DB::select('select * from people where pe_id=:pe_id;',['pe_id'=> $st->witness_pe_id]);
-            $witness[] = $witnes[0];
+            if (!($st->witness_pe_id)==NULL) {
+                $witnes = DB::select('select * from people where pe_id=:pe_id;', ['pe_id' => $st->witness_pe_id]);
+                $witness[] = $witnes[0];
+            }
         }
+
 
         return view('case', [
@@ -86,6 +139,6 @@
             'statements'=>$statements,
             'evidence'=>$evidence,
-            'victims'=> $victims,
-            'witness'=> $witness
+            'victims' => $victims,
+            'witness' =>$witness
         ]);
 
