Changeset cf84baa
- Timestamp:
- 02/08/24 16:15:01 (9 months ago)
- Branches:
- main
- Children:
- 6dec591
- Parents:
- 6b10b67
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
app/Http/Controllers/OfficerController.php
r6b10b67 rcf84baa 4 4 5 5 use App\Models\Policeman; 6 use Illuminate\Contracts\Auth\Authenticatable; 6 7 use Illuminate\Http\Request; 7 8 use Illuminate\Support\Facades\DB; … … 21 22 return view('register-policeman'); 22 23 } 24 25 23 26 } -
app/Http/Controllers/PeopleController.php
r6b10b67 rcf84baa 4 4 5 5 use Illuminate\Http\Request; 6 use Illuminate\Support\Facades\DB; 6 7 7 8 class PeopleController extends Controller 8 9 { 9 10 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 ]); 11 28 } 12 29 } -
app/Http/Controllers/SessionsController.php
r6b10b67 rcf84baa 3 3 namespace App\Http\Controllers; 4 4 5 use App\Models\Officer; 5 6 use Illuminate\Http\Request; 7 use Illuminate\Support\Facades\Auth; 8 use Illuminate\Support\Facades\DB; 9 use Illuminate\Support\Facades\Session; 6 10 7 11 class SessionsController extends Controller 8 12 { 9 // 13 public function store() 14 { 15 16 $credentials = request()->validate([ 17 'badge_no' => 'required', 18 'password' => 'required' 19 ]); 20 $password = $credentials['password']; 21 $badge_no = $credentials['badge_no']; 22 $policeman = true; 23 $exists = DB::select('select * from policeman where badge_no = :badge_no;', ['badge_no' => $badge_no]); 24 $pass = DB::select('select p_password from policeman where badge_no = :badge_no;', ['badge_no' => $badge_no]); 25 if($exists == null) { 26 $exists = DB::select('select * from officer where o_badge_no = :badge_no;', ['badge_no' => $badge_no]); 27 $pass = DB::select('select o_password from officer where o_badge_no = :badge_no;', ['badge_no' => $badge_no]); 28 $policeman = false; 29 } 30 if($exists == null) { 31 return back()->withErrors(['badge_no' => 'Invalid credentials']); 32 } 33 34 foreach ($pass[0] as $key => $val) { 35 $value = $val; 36 break; // Break after the first key-value pair 37 } 38 39 40 if ($value == $password) { 41 // Authentication passed 42 Session::put('badge_no', $badge_no); 43 Session::put('is_policeman', $policeman); 44 return redirect()->intended('/'); 45 } 46 47 // Authentication failed 48 return back()->withErrors(['password' => 'Invalid credentials']); 49 } 50 51 public function logout() 52 { 53 Session::forget('badge_no'); 54 Session::forget('is_policeman'); 55 return redirect('/login'); 56 } 10 57 } -
resources/views/case.blade.php
r6b10b67 rcf84baa 74 74 <a href="#" class="block px-4 py-2 account-link hover:text-white">Профил</a> 75 75 <a href="#" class="block px-4 py-2 account-link hover:text-white">Помош</a> 76 <a href=" #" class="block px-4 py-2 account-link hover:text-white">Одјави се</a>76 <a href="/logout" class="block px-4 py-2 account-link hover:text-white">Одјави се</a> 77 77 </div> 78 78 </div> -
resources/views/cases.blade.php
r6b10b67 rcf84baa 74 74 <a href="#" class="block px-4 py-2 account-link hover:text-white">Профил</a> 75 75 <a href="#" class="block px-4 py-2 account-link hover:text-white">Помош</a> 76 <a href=" #" class="block px-4 py-2 account-link hover:text-white">Одјави се</a>76 <a href="/logout" class="block px-4 py-2 account-link hover:text-white">Одјави се</a> 77 77 </div> 78 78 </div> -
resources/views/employees.blade.php
r6b10b67 rcf84baa 101 101 <a href="#" class="block px-4 py-2 account-link hover:text-white">Профил</a> 102 102 <a href="#" class="block px-4 py-2 account-link hover:text-white">Помош</a> 103 <a href=" #" class="block px-4 py-2 account-link hover:text-white">Одјави се</a>103 <a href="/logout" class="block px-4 py-2 account-link hover:text-white">Одјави се</a> 104 104 </div> 105 105 </div> -
resources/views/filter.blade.php
r6b10b67 rcf84baa 154 154 <a href="#" class="block px-4 py-2 account-link hover:text-white">Профил</a> 155 155 <a href="#" class="block px-4 py-2 account-link hover:text-white">Помош</a> 156 <a href=" #" class="block px-4 py-2 account-link hover:text-white">Одјави се</a>156 <a href="/logout" class="block px-4 py-2 account-link hover:text-white">Одјави се</a> 157 157 </div> 158 158 </div> … … 216 216 <h1 class="text-3xl text-black pb-6">Контролна табла</h1> 217 217 <div style="width: 600px"> 218 <form >219 <label for="default-search" class="mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white">Search</label>218 <form action="/filter" method="post"> 219 @csrf 220 220 <div class="relative"> 221 221 <div class="absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none"> … … 224 224 </svg> 225 225 </div> 226 <input type="search" id="default-search" class="block w-full p-4 ps-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="Пребарај матичен број..." required> 226 227 <label for="embg" class="mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white">Search</label> 228 <input type="text" id="embg" name="embg" class="block w-full p-4 ps-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="Пребарај матичен број..." required> 227 229 <button type="submit" class="text-white absolute end-2.5 bottom-2.5 bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">Search</button> 228 230 </div> … … 269 271 270 272 271 <div class="w-full mt-12"> 272 <p class="text-xl pb-3 flex items-center"> 273 <i class="fas fa-list mr-3"></i> Граѓани 274 </p> 275 276 <div class="bg-white overflow-auto"> 273 <div class="bg-white overflow-auto max-h-96"> 277 274 <table class="min-w-full bg-white"> 278 275 <thead class="bg-gray-800 text-white"> … … 289 286 </thead> 290 287 <tbody class="text-gray-700"> 291 <tr> 292 <td class="w-1/3 text-left py-3 px-4">1011001470303</td> 293 <td class="w-1/3 text-left py-3 px-4">Емир</td> 294 <td class="w-1/3 text-left py-3 px-4">Абази</td> 295 <td class="w-1/3 text-left py-3 px-4">М</td> 296 <td class="w-1/3 text-left py-3 px-4">ул.Македонија бр.80 Тетово</td> 297 <td class="w-1/3 text-left py-3 px-4">Македонија</td> 298 <td class="w-1/3 text-left py-3 px-4">Албанец</td> 299 <td class="text-left py-3 px-4"><a class="hover:text-blue-500" href="tel:622322662">622322662</a></td> 300 </tr> 301 <tr class="bg-gray-200"> 302 <td class="w-1/3 text-left py-3 px-4">0302954470303</td> 303 <td class="w-1/3 text-left py-3 px-4">Василија</td> 304 <td class="w-1/3 text-left py-3 px-4">Васиљоска</td> 305 <td class="w-1/3 text-left py-3 px-4">Ж</td> 306 <td class="w-1/3 text-left py-3 px-4">ул.154 бр.20 Скопје</td> 307 <td class="w-1/3 text-left py-3 px-4">Македонија</td> 308 <td class="w-1/3 text-left py-3 px-4">Македонка</td> 309 <td class="text-left py-3 px-4"><a class="hover:text-blue-500" href="tel:622322662">622322662</a></td> 310 </tr> 288 289 @foreach($peoples as $people) 290 <tr> 291 <td class="w-1/3 text-left py-3 px-4">{{$people->embg}}</td> 292 <td class="w-1/3 text-left py-3 px-4">{{$people->first_name}}</td> 293 <td class="w-1/3 text-left py-3 px-4">{{$people->last_name}}</td> 294 <td class="w-1/3 text-left py-3 px-4">{{$people->gender}}</td> 295 <td class="w-1/3 text-left py-3 px-4">{{$people->address}}</td> 296 <td class="w-1/3 text-left py-3 px-4">{{$people->country}}</td> 297 <td class="w-1/3 text-left py-3 px-4">{{$people->nationality}}</td> 298 <td class="text-left py-3 px-4"><a class="hover:text-blue-500" href="tel:622322662">{{$people->contact}}</a></td> 299 </tr> 300 @endforeach 311 301 </tbody> 312 302 </table> -
resources/views/login.blade.php
r6b10b67 rcf84baa 44 44 Најави се на твојот профил 45 45 </h1> 46 <form class="space-y-4 md:space-y-6" action="#"> 46 <form class="space-y-4 md:space-y-6" method="POST" action="/login" > 47 @csrf 47 48 <div> 48 <label for=" email" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Е-маил</label>49 <input type=" email" name="email" id="email" class="bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="ime.prezime@policiska_stanica.mk" required="">49 <label for="badge_no" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Број на значка</label> 50 <input type="text" name="badge_no" id="badge_no" class="bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="Број на значка" required=""> 50 51 </div> 52 @error('badge_no') 53 <p class="text-red-500 text-xs mt-1">{{$message}}</p> 54 @enderror 51 55 <div> 52 56 <label for="password" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Лозинка</label> 53 57 <input type="password" name="password" id="password" placeholder="••••••••" class="bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" required=""> 54 58 </div> 59 @error('password') 60 <p class="text-red-500 text-xs mt-1">{{$message}}</p> 61 @enderror 62 55 63 <div class="flex items-center justify-between"> 56 64 <div class="flex items-start"> 57 65 <div class="flex items-center h-5"> 58 <input id="remember" aria-describedby="remember" type="checkbox" class="w-4 h-4 border border-gray-300 rounded bg-gray-50 focus:ring-3 focus:ring-primary-300 dark:bg-gray-700 dark:border-gray-600 dark:focus:ring-primary-600 dark:ring-offset-gray-800" required="">66 <input id="remember" aria-describedby="remember" type="checkbox" class="w-4 h-4 border border-gray-300 rounded bg-gray-50 focus:ring-3 focus:ring-primary-300 dark:bg-gray-700 dark:border-gray-600 dark:focus:ring-primary-600 dark:ring-offset-gray-800"> 59 67 </div> 60 68 <div class="ml-3 text-sm"> -
resources/views/register-policeman.blade.php
r6b10b67 rcf84baa 164 164 <a href="#" class="block px-4 py-2 account-link hover:text-white">Профил</a> 165 165 <a href="#" class="block px-4 py-2 account-link hover:text-white">Помош</a> 166 <a href=" #"class="block px-4 py-2 account-link hover:text-white">Одјави се</a>166 <a href="/logout"class="block px-4 py-2 account-link hover:text-white">Одјави се</a> 167 167 </div> 168 168 </div> -
resources/views/welcome.blade.php
r6b10b67 rcf84baa 29 29 <aside class="relative bg-sidebar h-screen w-64 hidden sm:block shadow-xl"> 30 30 <div class="p-6"> 31 <a href="#" class="text-white text-3xl font-semibold uppercase hover:text-gray-300">Началник</a> 31 @if (Session::get('is_policeman')) 32 <a href="#" class="text-white text-3xl font-semibold uppercase hover:text-gray-300">Полицаец</a> 33 @else 34 <a href="#" class="text-white text-3xl font-semibold uppercase hover:text-gray-300">Началник</a> 35 @endif 32 36 <button class="w-full bg-white cta-btn font-semibold py-2 mt-5 rounded-br-lg rounded-bl-lg rounded-tr-lg shadow-lg hover:shadow-xl hover:bg-gray-300 flex items-center justify-center"> 33 37 <i class="fas fa-plus mr-3"></i> Додади полицаец … … 74 78 <a href="#" class="block px-4 py-2 account-link hover:text-white">Профил</a> 75 79 <a href="#" class="block px-4 py-2 account-link hover:text-white">Помош</a> 76 <a href=" #" class="block px-4 py-2 account-link hover:text-white">Одјави се</a>80 <a href="/logout" class="block px-4 py-2 account-link hover:text-white">Одјави се</a> 77 81 </div> 78 82 </div> -
routes/web.php
r6b10b67 rcf84baa 23 23 Route::get('/login', function () { 24 24 return view('login'); 25 25 26 }); 26 27 27 Route::post('logout', [SessionsController::class, 'destroy'])->middleware('auth'); 28 Route::post('/login', [SessionsController::class, 'store']); 29 30 31 Route::get('logout', [SessionsController::class, 'logout']); 28 32 29 33 … … 31 35 Route::get('employees', [OfficerController::class, 'employees'])->middleware('guest'); 32 36 Route::get('filter', [PeopleController::class, 'filter'])->middleware('guest'); 37 Route::post('filter', [PeopleController::class, 'filter_post'])->middleware('guest'); 38 33 39 Route::get('cases', [CrimeCaseController::class, 'cases'])->middleware('guest'); 34 40 Route::get('case', [CrimeCaseController::class, 'case'])->middleware('guest');
Note:
See TracChangeset
for help on using the changeset viewer.