Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
simpkm
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Farendi Giotivano R.P
simpkm
Commits
557e5d2a
Commit
557e5d2a
authored
Nov 08, 2022
by
novanbagus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update reviewer otomatis create user
parent
c67ada6f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
1 deletions
+66
-1
app/Http/Controllers/Operator/ReviewerController.php
+5
-0
app/Repositories/Auth/BiodataRepository.php
+3
-1
app/Traits/LoginTrait.php
+58
-0
No files found.
app/Http/Controllers/Operator/ReviewerController.php
View file @
557e5d2a
...
@@ -14,9 +14,12 @@ use GuzzleHttp\Client;
...
@@ -14,9 +14,12 @@ use GuzzleHttp\Client;
use
App\Models\Reviewer
;
use
App\Models\Reviewer
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
use
App\Http\Controllers\Authentication\LoginController
;
use
App\Traits\LoginTrait
;
class
ReviewerController
extends
Controller
class
ReviewerController
extends
Controller
{
{
use
LoginTrait
;
public
function
index
()
public
function
index
()
{
{
return
view
(
'backend.operator.reviewer.index'
)
->
withTitle
(
'Reviewer Seleksi Internal'
);
return
view
(
'backend.operator.reviewer.index'
)
->
withTitle
(
'Reviewer Seleksi Internal'
);
...
@@ -106,6 +109,8 @@ class ReviewerController extends Controller
...
@@ -106,6 +109,8 @@ class ReviewerController extends Controller
$reqPeriodeId
=
'9857a29d-521f-413a-b811-94cda7b45897'
;
$reqPeriodeId
=
'9857a29d-521f-413a-b811-94cda7b45897'
;
$reqJenisMonevId
=
'ba11c2b5-d65d-4360-9717-98e4fa9b9188'
;
$reqJenisMonevId
=
'ba11c2b5-d65d-4360-9717-98e4fa9b9188'
;
$result
=
$this
->
login_reviewer
(
$request
->
input
(
'nidn'
));
$ada_data
=
Reviewer
::
where
([
$ada_data
=
Reviewer
::
where
([
[
'id_sdm'
,
'='
,
$request
->
input
(
'id_sdm'
)],
[
'id_sdm'
,
'='
,
$request
->
input
(
'id_sdm'
)],
[
'periode_id'
,
'='
,
$reqPeriodeId
],
[
'periode_id'
,
'='
,
$reqPeriodeId
],
...
...
app/Repositories/Auth/BiodataRepository.php
View file @
557e5d2a
...
@@ -33,7 +33,9 @@ class BiodataRepository
...
@@ -33,7 +33,9 @@ class BiodataRepository
$apiRequest
=
$client
->
request
(
'GET'
,
'https://i-sdm.unesa.ac.id/biodataumum/'
.
trim
(
$auth
[
0
]
->
userid
));
$apiRequest
=
$client
->
request
(
'GET'
,
'https://i-sdm.unesa.ac.id/biodataumum/'
.
trim
(
$auth
[
0
]
->
userid
));
$isdm
=
json_decode
(
$apiRequest
->
getBody
()
->
getContents
());
$isdm
=
json_decode
(
$apiRequest
->
getBody
()
->
getContents
());
$data
[
'email'
]
=
$auth
[
0
]
->
email
;
// ubah novan karena ambil email dari isdm saja jangan dari auth;
// $data['email'] = $auth[0]->email;
$data
[
'email'
]
=
$isdm
[
0
]
->
email
;
$data
[
'name'
]
=
$isdm
[
0
]
->
nama
;
$data
[
'name'
]
=
$isdm
[
0
]
->
nama
;
$data
[
'noid'
]
=
$isdm
[
0
]
->
nip
;
$data
[
'noid'
]
=
$isdm
[
0
]
->
nip
;
if
(
$isdm
[
0
]
->
isdosen
==
0
)
{
if
(
$isdm
[
0
]
->
isdosen
==
0
)
{
...
...
app/Traits/LoginTrait.php
0 → 100644
View file @
557e5d2a
<?php
namespace
App\Traits
;
use
App\Repositories\Auth\BiodataRepository
;
use
App\Repositories\Auth\RoleRepository
;
use
App\Repositories\Auth\UserRepository
;
use
App\Repositories\UserdetailRepository
;
use
Illuminate\Support\Str
;
trait
LoginTrait
{
private
$userRepo
;
private
$roleRepo
;
private
$biodataRepo
;
private
$userDetailRepo
;
public
function
__construct
(
UserRepository
$userRepo
,
RoleRepository
$roleRepo
,
BiodataRepository
$biodataRepo
,
UserdetailRepository
$userDetailRepo
)
{
$this
->
userRepo
=
$userRepo
;
$this
->
roleRepo
=
$roleRepo
;
$this
->
biodataRepo
=
$biodataRepo
;
$this
->
userDetailRepo
=
$userDetailRepo
;
}
public
function
login_reviewer
(
$nip
)
{
$user
=
$this
->
userRepo
->
find
(
null
,
$nip
,
null
);
if
(
$user
)
{
return
$this
->
getlogin
(
$user
->
id
);
}
else
{
return
$this
->
getAddReviewer
(
$nip
);
}
}
private
function
getAddReviewer
(
$nip
)
{
$id
=
(
string
)
Str
::
uuid
();
$data
=
collect
([
(
object
)
[
'jenis'
=>
'P'
,
'userid'
=>
$nip
]
]);
$biodata
=
$this
->
biodataRepo
->
biodata
(
$data
->
toArray
());
$user
=
$this
->
userRepo
->
storeSso
(
$id
,
$biodata
);
$roles
=
$this
->
roleRepo
->
roles
(
'reviewer'
);
$this
->
userDetailRepo
->
storeSso
(
$user
->
id
,
$biodata
);
$this
->
roleRepo
->
store
(
$user
,
$roles
);
return
'sukses'
;
}
}
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