Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
I
IPRSv2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Michael Ngei
IPRSv2
Commits
83b27d91
Commit
83b27d91
authored
Mar 24, 2025
by
Michael Ngei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added birth endpoint
parent
df5f2bf8
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
4 deletions
+63
-4
BirthRecord.php
app/Http/Controllers/API/BirthRecord.php
+40
-0
Searchform.php
app/Livewire/Search/Searchform.php
+21
-1
api.php
routes/api.php
+2
-3
No files found.
app/Http/Controllers/API/BirthRecord.php
0 → 100644
View file @
83b27d91
<?php
namespace
App\Http\Controllers\API
;
use
App\Http\Controllers\Controller
;
use
App\Models\Docum
;
use
App\Models\Human
;
use
Illuminate\Database\Eloquent\ModelNotFoundException
;
use
Illuminate\Http\Request
;
class
BirthRecord
extends
Controller
{
public
function
birth_check
(
Request
$request
)
:
\Illuminate\Http\JsonResponse
{
// Validate incoming JSON data
$validatedData
=
$request
->
validate
([
'entry_num'
=>
'required|string'
,
]);
$rid
=
Docum
::
where
(
'ser_num'
,
'='
,
$validatedData
[
'entry_num'
])
->
value
(
'rid_h'
);
if
(
$rid
){
$human
=
Human
::
where
(
'rid'
,
'='
,
$rid
)
->
whereColumn
(
'rid'
,
'pid'
)
->
get
([
'name'
,
'surn'
,
'last_name'
,
'sex'
,
'date_birth'
,
'date_death'
,
'maisha_num'
]);
if
(
$human
->
isEmpty
()){
return
response
()
->
json
([
'message'
=>
'No record found'
,
],
401
);
}
else
{
return
response
()
->
json
([
'message'
=>
'Birth Record Found!'
,
'data'
=>
$human
],
201
);
}
}
}
}
app/Livewire/Search/Searchform.php
View file @
83b27d91
...
@@ -69,6 +69,7 @@ class Searchform extends Component
...
@@ -69,6 +69,7 @@ class Searchform extends Component
break
;
break
;
case
'Birth'
:
case
'Birth'
:
if
(
!
empty
(
$this
->
searchBirthEntryNum
)){
if
(
!
empty
(
$this
->
searchBirthEntryNum
)){
$this
->
getBirthHuman
();
$this
->
getBirthHuman
();
}
else
{
}
else
{
session
()
->
flash
(
'error'
,
'Birth entry number not provided'
);
session
()
->
flash
(
'error'
,
'Birth entry number not provided'
);
...
@@ -216,7 +217,7 @@ class Searchform extends Component
...
@@ -216,7 +217,7 @@ class Searchform extends Component
*/
*/
private
function
getBirthHuman
()
:
void
private
function
getBirthHuman
()
:
void
{
{
if
(
!
empty
(
$this
->
searchBirthEntryNum
)){
/*
if(!empty($this->searchBirthEntryNum)){
$human = $this->searchIDocums($this->searchBirthEntryNum);
$human = $this->searchIDocums($this->searchBirthEntryNum);
$this->search_count=1;
$this->search_count=1;
...
@@ -228,6 +229,24 @@ class Searchform extends Component
...
@@ -228,6 +229,24 @@ class Searchform extends Component
$this->showTableResults();
$this->showTableResults();
}else{
}else{
session()->flash('error', 'Search parameter is missing..');
session()->flash('error', 'Search parameter is missing..');
}*/
$rid
=
Docum
::
where
(
'ser_num'
,
'='
,
$this
->
searchBirthEntryNum
)
->
value
(
'rid_h'
);
if
(
$rid
){
$human
=
Human
::
where
(
'rid'
,
'='
,
$rid
)
->
whereColumn
(
'rid'
,
'pid'
)
->
get
([
'rid'
,
'pid'
,
'name'
,
'surn'
,
'last_name'
,
'sex'
,
'date_birth'
,
'date_death'
,
'o_pid'
]);
if
(
$human
->
isEmpty
()){
throw
new
ModelNotFoundException
(
'No record found'
);
}
else
{
$this
->
search_count
=
1
;
$this
->
doctype
=
'Birth'
;
$this
->
records_found
[]
=
$this
->
searchBirthEntryNum
;
$this
->
serial_number
[]
=
$this
->
searchBirthEntryNum
;
$this
->
humans
[]
=
$human
;
$this
->
dispatch
(
'viewResults'
,
$this
->
humans
,
$this
->
serial_number
,
$this
->
doctype
,
$this
->
records_not_found
,
$this
->
search_count
,
$this
->
records_found
);
}
}
}
}
}
...
@@ -242,4 +261,5 @@ class Searchform extends Component
...
@@ -242,4 +261,5 @@ class Searchform extends Component
$this
->
search_count
,
$this
->
records_found
);
$this
->
search_count
,
$this
->
records_found
);
}
}
}
}
routes/api.php
View file @
83b27d91
<?php
<?php
use
App\Http\Controllers\API\AuthController
;
use
App\Http\Controllers\API\AuthController
;
use
App\Http\Controllers\API\BirthRecord
;
use
App\Http\Controllers\API\Contracts
;
use
App\Http\Controllers\API\Contracts
;
use
App\Http\Controllers\API\Passport
;
use
App\Http\Controllers\API\Passport
;
use
App\Http\Controllers\API\PaymentsAPI
;
use
App\Http\Controllers\API\PaymentsAPI
;
...
@@ -40,10 +41,8 @@ Route::prefix('v1')->group(function () {
...
@@ -40,10 +41,8 @@ Route::prefix('v1')->group(function () {
//ID search
//ID search
Route
::
prefix
(
'verify'
)
->
group
(
function
()
{
Route
::
prefix
(
'verify'
)
->
group
(
function
()
{
Route
::
get
(
'id/{id}/serial/{serial}'
,
[
SearchIDdocument
::
class
,
'id_check'
]);
Route
::
get
(
'id/{id}/serial/{serial}'
,
[
SearchIDdocument
::
class
,
'id_check'
]);
});
//passport
Route
::
prefix
(
'verify'
)
->
group
(
function
()
{
Route
::
get
(
'passport/{passport_num}/id/{id_num}'
,
[
Passport
::
class
,
'passport_check'
]);
Route
::
get
(
'passport/{passport_num}/id/{id_num}'
,
[
Passport
::
class
,
'passport_check'
]);
Route
::
get
(
'birth'
,
[
BirthRecord
::
class
,
'birth_check'
]);
});
});
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment