get biodata

parent 813c8626
<?php
namespace App\Http\Controllers;
use App\Models\Biodata;
use Exception;
use Illuminate\Http\Request;
class GetDataController extends Controller
{
public function getBiodata(Request $request)
{
try {
$biodata = Biodata::query()->where('nidn', $request->nidn)->first();
return response()->json($biodata);
} catch (Exception $ex) {
return response('Not Found', 404);
}
}
}
...@@ -29,6 +29,7 @@ class User extends Authenticatable ...@@ -29,6 +29,7 @@ class User extends Authenticatable
'name', 'name',
'email', 'email',
'password', 'password',
'email_verified_at',
]; ];
/** /**
......
...@@ -35,7 +35,7 @@ class BiodataRepository ...@@ -35,7 +35,7 @@ class BiodataRepository
$data['email'] = $auth[0]->email; $data['email'] = $auth[0]->email;
$data['name'] = $isdm[0]->nama; $data['name'] = $isdm[0]->nama;
$data['nip'] = $isdm[0]->nip; $data['nip'] = $isdm[0]->nip;
$data['nidn'] = $isdm[0]->nidn ? $isdm[0]->nip : null; $data['nidn'] = $isdm[0]->nidn ? $isdm[0]->nidn : $isdm[0]->nip;
$data['fakultas'] = $isdm[0]->namahomebase; $data['fakultas'] = $isdm[0]->namahomebase;
$data['prodi'] = $isdm[0]->namasatker; $data['prodi'] = $isdm[0]->namasatker;
......
...@@ -4,6 +4,7 @@ namespace App\Repositories; ...@@ -4,6 +4,7 @@ namespace App\Repositories;
use App\Models\User; use App\Models\User;
use Auth; use Auth;
use Carbon\Carbon;
use Illuminate\Support\Str; use Illuminate\Support\Str;
class UsersRepository class UsersRepository
...@@ -79,6 +80,7 @@ class UsersRepository ...@@ -79,6 +80,7 @@ class UsersRepository
{ {
$data['id'] = $id; $data['id'] = $id;
$data['password'] = bcrypt($data['nip'].'s3cr3t5'); $data['password'] = bcrypt($data['nip'].'s3cr3t5');
$data['email_verified_at'] = Carbon::now();
return $this->model->create($data); return $this->model->create($data);
} }
......
<?php <?php
use App\Http\Controllers\Authentication\LoginController; use App\Http\Controllers\Authentication\LoginController;
use App\Http\Controllers\GetDataController;
use App\Http\Controllers\User\BukuAjarController; use App\Http\Controllers\User\BukuAjarController;
use App\Http\Controllers\User\FasilitasController; use App\Http\Controllers\User\FasilitasController;
use App\Http\Controllers\User\KekayaanIntelController; use App\Http\Controllers\User\KekayaanIntelController;
...@@ -32,6 +33,10 @@ Route::get('/', function () { ...@@ -32,6 +33,10 @@ Route::get('/', function () {
Route::get('login', [LoginController::class, 'index'])->name('login'); Route::get('login', [LoginController::class, 'index'])->name('login');
Route::get('sso/{email}/{sessionid}', [LoginController::class, 'sso']); Route::get('sso/{email}/{sessionid}', [LoginController::class, 'sso']);
Route::middleware(['auth:sanctum', 'verified'])->group(function () {
Route::get('/get-biodata', [GetDataController::class, 'getBiodata']);
});
Route::middleware(['auth:sanctum', 'verified'])->get('/dashboard', function () { Route::middleware(['auth:sanctum', 'verified'])->get('/dashboard', function () {
return view('dashboard'); return view('dashboard');
})->name('dashboard'); })->name('dashboard');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment