Commit efc8dc34 by Farendi Giotivano R.P

update view mahasiswa dosen upload

parent 6fe4511e
......@@ -16,7 +16,7 @@ DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_DRIVER=database
SESSION_LIFETIME=120
REDIS_HOST=127.0.0.1
......
<?php
namespace App\Actions\Fortify;
use App\Models\Team;
use App\Models\User;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Laravel\Fortify\Contracts\CreatesNewUsers;
use Laravel\Jetstream\Jetstream;
class CreateNewUser implements CreatesNewUsers
{
use PasswordValidationRules;
/**
* Create a newly registered user.
*
* @param array $input
* @return \App\Models\User
*/
public function create(array $input)
{
Validator::make($input, [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => $this->passwordRules(),
'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature() ? ['accepted', 'required'] : '',
])->validate();
return DB::transaction(function () use ($input) {
return tap(User::create([
'name' => $input['name'],
'email' => $input['email'],
'password' => Hash::make($input['password']),
]), function (User $user) {
$this->createTeam($user);
});
});
}
/**
* Create a personal team for the user.
*
* @param \App\Models\User $user
* @return void
*/
protected function createTeam(User $user)
{
$user->ownedTeams()->save(Team::forceCreate([
'user_id' => $user->id,
'name' => explode(' ', $user->name, 2)[0]."'s Team",
'personal_team' => true,
]));
}
}
<?php
namespace App\Actions\Fortify;
use Laravel\Fortify\Rules\Password;
trait PasswordValidationRules
{
/**
* Get the validation rules used to validate passwords.
*
* @return array
*/
protected function passwordRules()
{
return ['required', 'string', new Password, 'confirmed'];
}
}
<?php
namespace App\Actions\Fortify;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Laravel\Fortify\Contracts\ResetsUserPasswords;
class ResetUserPassword implements ResetsUserPasswords
{
use PasswordValidationRules;
/**
* Validate and reset the user's forgotten password.
*
* @param mixed $user
* @param array $input
* @return void
*/
public function reset($user, array $input)
{
Validator::make($input, [
'password' => $this->passwordRules(),
])->validate();
$user->forceFill([
'password' => Hash::make($input['password']),
])->save();
}
}
<?php
namespace App\Actions\Fortify;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Laravel\Fortify\Contracts\UpdatesUserPasswords;
class UpdateUserPassword implements UpdatesUserPasswords
{
use PasswordValidationRules;
/**
* Validate and update the user's password.
*
* @param mixed $user
* @param array $input
* @return void
*/
public function update($user, array $input)
{
Validator::make($input, [
'current_password' => ['required', 'string'],
'password' => $this->passwordRules(),
])->after(function ($validator) use ($user, $input) {
if (! isset($input['current_password']) || ! Hash::check($input['current_password'], $user->password)) {
$validator->errors()->add('current_password', __('The provided password does not match your current password.'));
}
})->validateWithBag('updatePassword');
$user->forceFill([
'password' => Hash::make($input['password']),
])->save();
}
}
<?php
namespace App\Actions\Fortify;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rule;
use Laravel\Fortify\Contracts\UpdatesUserProfileInformation;
class UpdateUserProfileInformation implements UpdatesUserProfileInformation
{
/**
* Validate and update the given user's profile information.
*
* @param mixed $user
* @param array $input
* @return void
*/
public function update($user, array $input)
{
Validator::make($input, [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'email', 'max:255', Rule::unique('users')->ignore($user->id)],
'photo' => ['nullable', 'mimes:jpg,jpeg,png', 'max:1024'],
])->validateWithBag('updateProfileInformation');
if (isset($input['photo'])) {
$user->updateProfilePhoto($input['photo']);
}
if ($input['email'] !== $user->email &&
$user instanceof MustVerifyEmail) {
$this->updateVerifiedUser($user, $input);
} else {
$user->forceFill([
'name' => $input['name'],
'email' => $input['email'],
])->save();
}
}
/**
* Update the given verified user's profile information.
*
* @param mixed $user
* @param array $input
* @return void
*/
protected function updateVerifiedUser($user, array $input)
{
$user->forceFill([
'name' => $input['name'],
'email' => $input['email'],
'email_verified_at' => null,
])->save();
$user->sendEmailVerificationNotification();
}
}
<?php
namespace App\Actions\Jetstream;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Validator;
use Laravel\Jetstream\Contracts\AddsTeamMembers;
use Laravel\Jetstream\Events\AddingTeamMember;
use Laravel\Jetstream\Events\TeamMemberAdded;
use Laravel\Jetstream\Jetstream;
use Laravel\Jetstream\Rules\Role;
class AddTeamMember implements AddsTeamMembers
{
/**
* Add a new team member to the given team.
*
* @param mixed $user
* @param mixed $team
* @param string $email
* @param string|null $role
* @return void
*/
public function add($user, $team, string $email, string $role = null)
{
Gate::forUser($user)->authorize('addTeamMember', $team);
$this->validate($team, $email, $role);
$newTeamMember = Jetstream::findUserByEmailOrFail($email);
AddingTeamMember::dispatch($team, $newTeamMember);
$team->users()->attach(
$newTeamMember, ['role' => $role]
);
TeamMemberAdded::dispatch($team, $newTeamMember);
}
/**
* Validate the add member operation.
*
* @param mixed $team
* @param string $email
* @param string|null $role
* @return void
*/
protected function validate($team, string $email, ?string $role)
{
Validator::make([
'email' => $email,
'role' => $role,
], $this->rules(), [
'email.exists' => __('We were unable to find a registered user with this email address.'),
])->after(
$this->ensureUserIsNotAlreadyOnTeam($team, $email)
)->validateWithBag('addTeamMember');
}
/**
* Get the validation rules for adding a team member.
*
* @return array
*/
protected function rules()
{
return array_filter([
'email' => ['required', 'email', 'exists:users'],
'role' => Jetstream::hasRoles()
? ['required', 'string', new Role]
: null,
]);
}
/**
* Ensure that the user is not already on the team.
*
* @param mixed $team
* @param string $email
* @return \Closure
*/
protected function ensureUserIsNotAlreadyOnTeam($team, string $email)
{
return function ($validator) use ($team, $email) {
$validator->errors()->addIf(
$team->hasUserWithEmail($email),
'email',
__('This user already belongs to the team.')
);
};
}
}
<?php
namespace App\Actions\Jetstream;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Validator;
use Laravel\Jetstream\Contracts\CreatesTeams;
use Laravel\Jetstream\Events\AddingTeam;
use Laravel\Jetstream\Jetstream;
class CreateTeam implements CreatesTeams
{
/**
* Validate and create a new team for the given user.
*
* @param mixed $user
* @param array $input
* @return mixed
*/
public function create($user, array $input)
{
Gate::forUser($user)->authorize('create', Jetstream::newTeamModel());
Validator::make($input, [
'name' => ['required', 'string', 'max:255'],
])->validateWithBag('createTeam');
AddingTeam::dispatch($user);
$user->switchTeam($team = $user->ownedTeams()->create([
'name' => $input['name'],
'personal_team' => false,
]));
return $team;
}
}
<?php
namespace App\Actions\Jetstream;
use Laravel\Jetstream\Contracts\DeletesTeams;
class DeleteTeam implements DeletesTeams
{
/**
* Delete the given team.
*
* @param mixed $team
* @return void
*/
public function delete($team)
{
$team->purge();
}
}
<?php
namespace App\Actions\Jetstream;
use Illuminate\Support\Facades\DB;
use Laravel\Jetstream\Contracts\DeletesTeams;
use Laravel\Jetstream\Contracts\DeletesUsers;
class DeleteUser implements DeletesUsers
{
/**
* The team deleter implementation.
*
* @var \Laravel\Jetstream\Contracts\DeletesTeams
*/
protected $deletesTeams;
/**
* Create a new action instance.
*
* @param \Laravel\Jetstream\Contracts\DeletesTeams $deletesTeams
* @return void
*/
public function __construct(DeletesTeams $deletesTeams)
{
$this->deletesTeams = $deletesTeams;
}
/**
* Delete the given user.
*
* @param mixed $user
* @return void
*/
public function delete($user)
{
DB::transaction(function () use ($user) {
$this->deleteTeams($user);
$user->deleteProfilePhoto();
$user->tokens->each->delete();
$user->delete();
});
}
/**
* Delete the teams and team associations attached to the user.
*
* @param mixed $user
* @return void
*/
protected function deleteTeams($user)
{
$user->teams()->detach();
$user->ownedTeams->each(function ($team) {
$this->deletesTeams->delete($team);
});
}
}
<?php
namespace App\Actions\Jetstream;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rule;
use Laravel\Jetstream\Contracts\InvitesTeamMembers;
use Laravel\Jetstream\Events\InvitingTeamMember;
use Laravel\Jetstream\Jetstream;
use Laravel\Jetstream\Mail\TeamInvitation;
use Laravel\Jetstream\Rules\Role;
class InviteTeamMember implements InvitesTeamMembers
{
/**
* Invite a new team member to the given team.
*
* @param mixed $user
* @param mixed $team
* @param string $email
* @param string|null $role
* @return void
*/
public function invite($user, $team, string $email, string $role = null)
{
Gate::forUser($user)->authorize('addTeamMember', $team);
$this->validate($team, $email, $role);
InvitingTeamMember::dispatch($team, $email, $role);
$invitation = $team->teamInvitations()->create([
'email' => $email,
'role' => $role,
]);
Mail::to($email)->send(new TeamInvitation($invitation));
}
/**
* Validate the invite member operation.
*
* @param mixed $team
* @param string $email
* @param string|null $role
* @return void
*/
protected function validate($team, string $email, ?string $role)
{
Validator::make([
'email' => $email,
'role' => $role,
], $this->rules($team), [
'email.unique' => __('This user has already been invited to the team.'),
])->after(
$this->ensureUserIsNotAlreadyOnTeam($team, $email)
)->validateWithBag('addTeamMember');
}
/**
* Get the validation rules for inviting a team member.
*
* @param mixed $team
* @return array
*/
protected function rules($team)
{
return array_filter([
'email' => ['required', 'email', Rule::unique('team_invitations')->where(function ($query) use ($team) {
$query->where('team_id', $team->id);
})],
'role' => Jetstream::hasRoles()
? ['required', 'string', new Role]
: null,
]);
}
/**
* Ensure that the user is not already on the team.
*
* @param mixed $team
* @param string $email
* @return \Closure
*/
protected function ensureUserIsNotAlreadyOnTeam($team, string $email)
{
return function ($validator) use ($team, $email) {
$validator->errors()->addIf(
$team->hasUserWithEmail($email),
'email',
__('This user already belongs to the team.')
);
};
}
}
<?php
namespace App\Actions\Jetstream;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Support\Facades\Gate;
use Illuminate\Validation\ValidationException;
use Laravel\Jetstream\Contracts\RemovesTeamMembers;
use Laravel\Jetstream\Events\TeamMemberRemoved;
class RemoveTeamMember implements RemovesTeamMembers
{
/**
* Remove the team member from the given team.
*
* @param mixed $user
* @param mixed $team
* @param mixed $teamMember
* @return void
*/
public function remove($user, $team, $teamMember)
{
$this->authorize($user, $team, $teamMember);
$this->ensureUserDoesNotOwnTeam($teamMember, $team);
$team->removeUser($teamMember);
TeamMemberRemoved::dispatch($team, $teamMember);
}
/**
* Authorize that the user can remove the team member.
*
* @param mixed $user
* @param mixed $team
* @param mixed $teamMember
* @return void
*/
protected function authorize($user, $team, $teamMember)
{
if (! Gate::forUser($user)->check('removeTeamMember', $team) &&
$user->id !== $teamMember->id) {
throw new AuthorizationException;
}
}
/**
* Ensure that the currently authenticated user does not own the team.
*
* @param mixed $teamMember
* @param mixed $team
* @return void
*/
protected function ensureUserDoesNotOwnTeam($teamMember, $team)
{
if ($teamMember->id === $team->owner->id) {
throw ValidationException::withMessages([
'team' => [__('You may not leave a team that you created.')],
])->errorBag('removeTeamMember');
}
}
}
<?php
namespace App\Actions\Jetstream;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Validator;
use Laravel\Jetstream\Contracts\UpdatesTeamNames;
class UpdateTeamName implements UpdatesTeamNames
{
/**
* Validate and update the given team's name.
*
* @param mixed $user
* @param mixed $team
* @param array $input
* @return void
*/
public function update($user, $team, array $input)
{
Gate::forUser($user)->authorize('update', $team);
Validator::make($input, [
'name' => ['required', 'string', 'max:255'],
])->validateWithBag('updateTeamName');
$team->forceFill([
'name' => $input['name'],
])->save();
}
}
<?php
if (!function_exists('tglbulanindo')) {
function tglbulanindo($waktu, $tipe = '')
{
$detik = substr($waktu, 17, 2);
$menit = substr($waktu, 14, 2);
$jam = substr($waktu, 11, 2);
$tgl = substr($waktu, 8, 2);
$bln = substr($waktu, 5, 2);
$thn = substr($waktu, 0, 4);
$bulan = ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember'];
$idxhari = date('N', strtotime($waktu));
switch ($tipe) {
case 1:
$full = $tgl.' '.$bulan[(int) $bln - 1].' '.$thn;
break;
case 2:
$full = $tgl.'/'.$bln.'/'.$thn;
break;
case 3:
$full = $tgl.'/'.$bln.'/'.$thn.' '.$jam.':'.$menit.':'.$detik;
break;
case 4:
$full = $tgl.' '.$bulan[(int) $bln - 1].' '.$thn.' '.$jam.':'.$menit;
break;
default:
$full = "$tgl ".$bulan[(int) $bln - 1]." $thn";
}
return $full;
}
}
<?php
namespace App\Helpers;
class InseoHelper
{
public static function tglbulanindo($waktu, $tipe = '')
{
$detik = substr($waktu, 17, 2);
$menit = substr($waktu, 14, 2);
$jam = substr($waktu, 11, 2);
$tgl = substr($waktu, 8, 2);
$bln = substr($waktu, 5, 2);
$thn = substr($waktu, 0, 4);
$bulan = ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'Nopember', 'Desember'];
$idxhari = date('N', strtotime($waktu));
switch ($tipe) {
case 1:
$full = $tgl.' '.$bulan[(int) $bln - 1].' '.$thn;
break;
case 2:
$full = $tgl.'/'.$bln.'/'.$thn;
break;
case 3:
$full = $tgl.'/'.$bln.'/'.$thn.' '.$jam.':'.$menit.':'.$detik;
break;
default:
$full = "$tgl ".$bulan[(int) $bln - 1]." $thn";
}
return $full;
}
public static function singkatan_fakultas()
{
$fak = [
'teknik' => 'FT',
'fakultas teknik' => 'FT',
'ft' => 'FT',
'fak. teknik' => 'FT',
'ilmu sosial & hukum' => 'FISH',
'fakultas ilmu sosial & hukum' => 'FISH',
'fish' => 'FISH',
'fak. ilmu sosial & hukum' => 'FISH',
'ilmu sosial dan hukum' => 'FISH',
'ilmu pendidikan' => 'FIP',
'fakultas ilmu pendidikan' => 'FIP',
'fip' => 'FIP',
'fak. ilmu pendidikan' => 'FIP',
'bahasa dan seni' => 'FBS',
'fakultas bahasa dan seni' => 'FBS',
'fbs' => 'FBS',
'fak. bahasa dan seni' => 'FBS',
'matematika dan ilmu pengetahuan alam' => 'FMIPA',
'fakultas matematika dan ilmu pengetahuan alam' => 'FMIPA',
'fmipa' => 'FMIPA',
'fak. matematika dan ilmu pengetahuan alam' => 'FMIPA',
'ilmu keolahragaan' => 'FIO',
'fakultas ilmu keolahragaan' => 'FIO',
'fio' => 'FIO',
'fak. ilmu keolahragaan' => 'FIO',
'ilmu olahraga' => 'FIO',
'fakultas ilmu olahraga' => 'FIO',
'fiK' => 'FIO',
'fak. ilmu olahraga' => 'FIO',
'ekonomi' => 'FE',
'fakultas ekonomi' => 'FE',
'fe' => 'FE',
'fak. ekonomi' => 'FE',
];
return $fak;
}
}
<?php
namespace App\Http\Controllers\Authentication;
use App\Http\Controllers\Controller;
use App\Repositories\Auth\BiodataRepository;
use App\Repositories\Auth\EmailRepository;
use App\Repositories\Auth\IsdmRepository;
use App\Repositories\Auth\RoleRepository;
use App\Repositories\Auth\SsoRepository;
use App\Repositories\Auth\UserRepository;
use App\Repositories\UserdetailRepository;
use Auth;
use Illuminate\Support\Str;
class LoginController extends Controller
{
private $ssoRepo;
private $userRepo;
private $roleRepo;
private $biodataRepo;
private $emailRepo;
private $isdmRepo;
private $userDetailRepo;
public function __construct(
SsoRepository $ssoRepo,
UserRepository $userRepo,
RoleRepository $roleRepo,
BiodataRepository $biodataRepo,
EmailRepository $emailRepo,
IsdmRepository $isdmRepo,
UserdetailRepository $userDetailRepo
) {
$this->middleware('guest');
$this->ssoRepo = $ssoRepo;
$this->userRepo = $userRepo;
$this->roleRepo = $roleRepo;
$this->biodataRepo = $biodataRepo;
$this->emailRepo = $emailRepo;
$this->isdmRepo = $isdmRepo;
$this->userDetailRepo = $userDetailRepo;
}
public function sso($email, $session_id)
{
$auth = $this->ssoRepo->sso($session_id);
if (!is_array($auth)) {
return redirect('https://sso.unesa.ac.id/user');
}
$user = $this->userRepo->find(null, null, $auth[0]->email);
if ($user) {
return $this->getlogin($user->id);
} else {
return $this->getadduser($auth);
}
}
private function getlogin($id)
{
Auth::loginUsingId($id);
return redirect()->intended('dashboard');
}
private function getAdduser($auth)
{
$id = (string) Str::uuid();
$biodata = $this->biodataRepo->biodata($auth);
$user = $this->userRepo->storeSso($id, $biodata);
$roles = $this->roleRepo->roles($biodata['role']);
$this->userDetailRepo->storeSso($user->id, $biodata);
$this->roleRepo->store($user, $roles);
Auth::loginUsingId($id);
return redirect()->intended('dashboard');
}
}
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class DashboardController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
$title = 'Dashboard PKM';
$data = [
'title' => $title,
];
return view('backend.index', $data);
}
}
<?php
namespace App\Http\Controllers\Dosen;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Crypt;
use Alert;
use Auth;
use App\Models\Auth\Biodata;
class BiodataController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
$title = 'Biodata Dosen';
$biodata = Biodata::query()->find(Auth::user()->id);
$data = [
'biodata' => $biodata,
'title' => $title,
];
return view('backend.dosen.biodata.index', $data);
}
public function update($nidn)
{
$nidn = Crypt::decrypt($nidn);
$biodata = $this->biodataRepo->find(null, null, null, $nidn);
$isdm = $this->isdmRepo->nidn($nidn);
$data = [
'biodata' => $biodata,
'isdm' => $isdm,
];
return view('dosen.syncIsdm.index', $data);
}
public function sync(Request $request)
{
$nidn = Crypt::decrypt($request->input('nidn'));
$biodata = $this->biodataRepo->find(null, null, null, $nidn);
$isdm = $this->isdmRepo->nidn($nidn);
$this->biodataRepo->sync($isdm, $biodata);
Alert::success('Biodata disesuaikan dengan ISDM');
return redirect()->route('dosen.biodatasync.index', ['nidn' => Crypt::encrypt($nidn)]);
}
}
<?php
namespace App\Http\Controllers\Dosen;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use App\Http\Controllers\GetDataApiController;
use App\Models\Kelompok;
use App\Models\KelompokDetail;
use App\Models\Periode;
use Session;
use Alert;
class KelompokController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
$title = 'Daftar Kelompok';
$bio = auth()->user()->rBiodata;
$getDosen = GetDataApiController::getDosen();
$periode = Periode::where('status', 1)->first();
$kelompok = Kelompok::with(['rAnggota'])
->where('nidn_dosen', $bio->noidentitas)
->orderBy('kode')
->get();
$cekKel = $kelompok->where('created_user', auth()->user()->id)->count();
$data = [
'kelompok' => $kelompok,
'title' => $title,
'cekKel' => $cekKel,
'dosen' => $getDosen['data'],
'periode' => $periode,
];
return view('backend.dosen.kelompok.index', $data);
}
public function tolak(Request $request)
{
$kel = $request->except('_token');
$kelompok = Kelompok::query()->find(decrypt($kel['id']));
$kelompok->status = 2;
$kelompok->save();
Alert::success('Berhasil disimpan');
return redirect()->route('dosen.kelompok.index');
}
public function terima(Request $request)
{
$kel = $request->except('_token');
$kelompok = Kelompok::query()->find(decrypt($kel['id']));
$kelompok->status = 1;
$kelompok->save();
Alert::success('Berhasil disimpan');
return redirect()->route('dosen.kelompok.index');
}
}
<?php
namespace App\Http\Controllers\Dosen;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Proposal;
use App\Models\Kelompok;
use App\Models\Periode;
use App\Models\Jenis;
use Session;
use Alert;
use Auth;
class MonevController extends Controller
{
public function monevsatu()
{
$title = 'Monev Internal I';
$bio = auth()->user()->rBiodata;
$nim = $bio->noidentitas;
$proposal = Proposal::with(['rKelompok', 'rJenis'])
->whereHas('rKelompok', function ($query) use($bio){
$query->where('nidn_dosen', $bio->noidentitas);
})
->orderBy('kelompok_id')
->get();
$data = [
'proposal' => $proposal,
'title' => $title,
];
return view('backend.dosen.monev.indexmonev1', $data);
}
public function monevdua()
{
$title = 'Monev Internal I';
$bio = auth()->user()->rBiodata;
$nim = $bio->noidentitas;
$proposal = Proposal::with(['rKelompok', 'rJenis'])
->whereHas('rKelompok', function ($query) use($bio){
$query->where('nidn_dosen', $bio->noidentitas);
})
->orderBy('kelompok_id')
->get();
$data = [
'proposal' => $proposal,
'title' => $title,
];
return view('backend.dosen.monev.indexmonev2', $data);
}
public function monevtiga()
{
$title = 'Monev Internal I';
$bio = auth()->user()->rBiodata;
$nim = $bio->noidentitas;
$proposal = Proposal::with(['rKelompok', 'rJenis'])
->whereHas('rKelompok', function ($query) use($bio){
$query->where('nidn_dosen', $bio->noidentitas);
})
->orderBy('kelompok_id')
->get();
$data = [
'proposal' => $proposal,
'title' => $title,
];
return view('backend.dosen.monev.indexmonev3', $data);
}
}
<?php
namespace App\Http\Controllers\Dosen;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Http\Controllers\GetDataApiController;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use App\Models\Proposal;
use App\Models\Kelompok;
use App\Models\Periode;
use App\Models\Jenis;
use Session;
use Alert;
use Auth;
class ProposalController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
$title = 'Daftar Proposal';
$bio = auth()->user()->rBiodata;
$proposal = Proposal::with(['rKelompok', 'rJenis'])
->whereHas('rKelompok', function ($query) use($bio){
$query->where('nidn_dosen', $bio->noidentitas);
})
->orderBy('kelompok_id')
->get();
$data = [
'proposal' => $proposal,
'title' => $title,
];
return view('backend.dosen.proposal.index', $data);
}
public function setuju(Request $request)
{
$proId = $request->except('_token');
$proposal = Proposal::query()->find(decrypt($proId['id']));
$proposal->status = 2;
$proposal->date_approval = now();
$proposal->save();
Alert::success('Berhasil disimpan');
return redirect()->route('dosen.proposal.index');
}
}
<?php
namespace App\Http\Controllers\Dosen;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Http\Controllers\GetDataApiController;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use App\Models\Proposal;
use App\Models\Kelompok;
use App\Models\Periode;
use App\Models\Jenis;
use Session;
use Alert;
use Auth;
class SeleksiController extends Controller
{
public function seleksiInternal()
{
//
$title = 'Seleksi Internal Mahasiswa';
$bio = auth()->user()->rBiodata;
$nim = $bio->noidentitas;
$proposal = Proposal::with(['rKelompok', 'rJenis'])
->whereHas('rKelompok', function ($query) use($bio){
$query->where('nidn_dosen', $bio->noidentitas);
})
->orderBy('kelompok_id')
->get();
$data = [
'proposal' => $proposal,
'title' => $title,
];
return view('backend.dosen.seleksi.index_internal', $data);
}
public function seleksiBelmawa()
{
//
$title = 'Seleksi Belmawa Mahasiswa';
$bio = auth()->user()->rBiodata;
$nim = $bio->noidentitas;
$proposal = Proposal::with(['rKelompok', 'rJenis'])
->whereHas('rKelompok', function ($query) use($bio){
$query->where('nidn_dosen', $bio->noidentitas);
})
->orderBy('kelompok_id')
->get();
$data = [
'proposal' => $proposal,
'title' => $title,
];
return view('backend.dosen.seleksi.index_belmawa', $data);
}
}
<?php
namespace App\Http\Controllers;
use Exception;
use Illuminate\Http\Request;
use GuzzleHttp\Client;
class GetDataApiController extends Controller
{
const URL = 'https://siakadu.unesa.ac.id/api/apiunggun';
const URLS = 'https://siakadu.unesa.ac.id/api/dashboard';
//
public static function getDosen()
{
$client = new Client();
$apiRequest = $client->request('POST', GetDataApiController::URLS, [
'form_params' =>
[
'kondisi' => 'dosen_aktif',
]
]);
return json_decode($apiRequest->getBody()->getContents(), true);
}
public function getAccount($nim)
{
$client = new Client();
$apiRequest = $client->request('POST', GetDataApiController::URL, [
'form_params' =>
[
'username' => $nim,
'kondisi' => 'cekhakakses'
]
]);
$gcon = utf8_encode($apiRequest->getBody()->getContents());
$data = unserialize($gcon);
return $data;
}
}
<?php
namespace App\Http\Controllers\Mahasiswa;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Http\Controllers\GetDataApiController;
use App\Models\Kelompok;
use App\Models\KelompokDetail;
use Session;
use Alert;
class AnggotaController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
$title = 'Tambah Kelompok Mahasiswa';
$kode = null;
// $getMhs = GetDataApiController::getAccount(19021264056);
// dd($getMhs);
$data = [
'title' => $title,
'kode' => $kode
];
return view('backend.mahasiswa.kelompok.personil.create', $data);
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
$kelompok = $request->except('_token');
$cek = KelompokDetail::where('kelompok_id', $kelompok['kelompok_id'])->where('nim', $kelompok['nim'])->count();
if ($cek > 0) {
Alert::warning('Mahasiswa sudah terdaftar', '-')->persistent('Ok');
return redirect()->route('mahasiswa.kelompok.createnew', ['id' => encrypt($kelompok['kelompok_id'])]);
}
if ($cek > 5) {
Alert::warning('Anggota kelompok sudah maksimal', '-');
return redirect()->route('mahasiswa.kelompok.createnew', ['id' => encrypt($kelompok['kelompok_id'])]);
}
KelompokDetail::create($kelompok);
Alert::success('Berhasil disimpan');
return redirect()->route('mahasiswa.kelompok.createnew', ['id' => encrypt($kelompok['kelompok_id'])]);
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}
<?php
namespace App\Http\Controllers\Mahasiswa;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Crypt;
use Alert;
use Auth;
use App\Models\Auth\Biodata;
class BiodataController extends Controller
{
public function index()
{
$title = 'Biodata Mahasiswa';
$biodata = Biodata::query()->find(Auth::user()->id);
$data = [
'biodata' => $biodata,
'title' => $title,
];
return view('backend.mahasiswa.biodata.index', $data);
}
public function update($nidn)
{
$nidn = Crypt::decrypt($nidn);
$biodata = $this->biodataRepo->find(null, null, null, $nidn);
$isdm = $this->isdmRepo->nidn($nidn);
$data = [
'biodata' => $biodata,
'isdm' => $isdm,
];
return view('mahasiswa.syncIsdm.index', $data);
}
public function sync(Request $request)
{
$nidn = Crypt::decrypt($request->input('nidn'));
$biodata = $this->biodataRepo->find(null, null, null, $nidn);
$isdm = $this->isdmRepo->nidn($nidn);
$this->biodataRepo->sync($isdm, $biodata);
Alert::success('Biodata disesuaikan dengan ISDM');
return redirect()->route('mahasiswa.biodatasync.index', ['nidn' => Crypt::encrypt($nidn)]);
}
}
<?php
namespace App\Http\Controllers\Mahasiswa;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use App\Http\Controllers\GetDataApiController;
use App\Models\Kelompok;
use App\Models\KelompokDetail;
use App\Models\Periode;
use Session;
use Alert;
class KelompokController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
$title = 'Kelompok Mahasiswa';
$bio = auth()->user()->rBiodata;
$nim = $bio->noidentitas;
$getDosen = GetDataApiController::getDosen();
$periode = Periode::where('status', 1)->first();
$kelompok = Kelompok::with(['rAnggota'])
->whereHas('rAnggota', function ($query) use($nim){
$query->where('nim', $nim);
})
->orderBy('kode')
->get();
$cekKel = $kelompok->where('created_user', auth()->user()->id)->count();
// $getMhs = GetDataApiController::getAccount(20030244001);
// dd($getMhs);
$data = [
'kelompok' => $kelompok,
'title' => $title,
'cekKel' => $cekKel,
'dosen' => $getDosen['data'],
'periode' => $periode,
];
return view('backend.mahasiswa.kelompok.index', $data);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
public function newkelompok($id)
{
//
$kelompok_id = decrypt($id);
Session::put('ss_kelompokid', $kelompok_id);
$title = 'Tambah Kelompok Mahasiswa';
$kelompok = Kelompok::with('rAnggota')->where('kelompok_id', $kelompok_id)->first();
$periode = Periode::where('status', 1)->first();
$getDosen = GetDataApiController::getDosen();
$data = [
'kelompok' => $kelompok,
'title' => $title,
'dosen' => $getDosen['data'],
];
return view('backend.mahasiswa.kelompok.createkel', $data);
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
$kelompok = $request->except('_token');
$dosen = explode('_', decrypt($kelompok['dosen']));
$dosen_idsdm = $dosen[0];
$dosen_nama = $dosen[1];
$dosen_nidn = $dosen[2];
$bio = auth()->user()->rBiodata;
$kel = Kelompok::create([
'periode_id' => $kelompok['periode'],
'id_sdm' => $dosen_idsdm,
'nama_dosen' => $dosen_nama,
'nidn_dosen' => $dosen_nidn,
'created_user' => Auth::user()->id
]);
KelompokDetail::create([
'kelompok_id' => $kel->kelompok_id,
'id_reg_pd' => $bio->user_id,
'nim' => $bio->noidentitas,
'nama' => $bio->name,
'fakultas' => $bio->fakultas,
'prodi' => $bio->prodi,
'status_ketua' => '1',
'created_user' => Auth::user()->id
]);
return redirect()->intended(route('mahasiswa.kelompok.createnew', ['id' => encrypt($kel->kelompok_id)]))->with('success', 'Berhasil Melakukan Verifikasi!');
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
public function kirim(Request $request)
{
//
$kel = $request->except('_token');
$kelompok = Kelompok::query()->find($kel['kelompok_id']);
$kelompok->kirim = 1;
$kelompok->save();
Alert::success('Berhasil disimpan');
return redirect()->route('mahasiswa.kelompok.index');
}
public function hapus(Request $request)
{
$kel = $request->except('_token');
$kelompok = Kelompok::query()->find(decrypt($kel['id']));
$kelompok->rAnggota()->delete();
$kelompok->delete();
Alert::success('Berhasil dihapus');
return redirect()->route('mahasiswa.kelompok.index');
}
}
<?php
namespace App\Http\Controllers\Mahasiswa;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Http\Controllers\GetDataApiController;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use App\Models\Proposal;
use App\Models\Kelompok;
use App\Models\Periode;
use App\Models\Jenis;
use Session;
use Alert;
use Auth;
class MonevController extends Controller
{
public function monevsatu()
{
$title = 'Monev Internal I';
$bio = auth()->user()->rBiodata;
$nim = $bio->noidentitas;
$proposal = Proposal::with(['rKelompok', 'rJenis'])
->whereHas('rKelompok', function ($query) use($nim){
$query->whereHas('rAnggota', function ($query) use($nim){
$query->where('nim', $nim);
});
})
->orderBy('kelompok_id')
->get();
$data = [
'proposal' => $proposal,
'title' => $title,
];
return view('backend.mahasiswa.monev.indexmonev1', $data);
}
public function monevdua()
{
$title = 'Monev Internal II';
$bio = auth()->user()->rBiodata;
$nim = $bio->noidentitas;
$proposal = Proposal::with(['rKelompok', 'rJenis'])
->whereHas('rKelompok', function ($query) use($nim){
$query->whereHas('rAnggota', function ($query) use($nim){
$query->where('nim', $nim);
});
})
->orderBy('kelompok_id')
->get();
$data = [
'proposal' => $proposal,
'title' => $title,
];
return view('backend.mahasiswa.monev.indexmonev2', $data);
}
public function monevtiga()
{
$title = 'Monev Internal III';
$bio = auth()->user()->rBiodata;
$nim = $bio->noidentitas;
$proposal = Proposal::with(['rKelompok', 'rJenis'])
->whereHas('rKelompok', function ($query) use($nim){
$query->whereHas('rAnggota', function ($query) use($nim){
$query->where('nim', $nim);
});
})
->orderBy('kelompok_id')
->get();
$data = [
'proposal' => $proposal,
'title' => $title,
];
return view('backend.mahasiswa.monev.indexmonev3', $data);
}
public function revisiMonev($id)
{
//
$id = explode('__', decrypt($id));
$proposal = Proposal::with(['rJenis'])->find($id[0]);
if($id[1] == 'logbook'){ $title = 'Upload Logbook'; }
elseif($id[1] == 'kemajuan'){ $title = 'Upload Laporan Kemajuan';}
else{ $title = 'Upload Laporan Akhir'; }
$data = [
'proposal' => $proposal,
'title' => $title,
'type' => $id[1],
'monev' => $id[2],
];
return view('backend.mahasiswa.monev.upload_monev', $data);
}
public function uploadMonev(Request $request)
{
//
$pro = $request->except('_token');
$proposal = Proposal::with(['rPeriode'])->find($pro['proposal_id']);
$file_nama = $proposal->rPeriode->nama.'_'.$proposal->proposal_id.'.'.$pro['file']->getClientOriginalExtension();
Storage::disk('static')->put('simpkm/'.$pro['type'].'/'.$proposal->rPeriode->nama.'/'.$file_nama, file_get_contents($pro['file']->getRealPath()));
if($pro['type'] == 'logbook') {
$proposal->logbook_file = $file_nama ;
$proposal->logbook_date = now();
$proposal->save();
} elseif($pro['type'] == 'kemajuan') {
$proposal->laporan_kemajuan_file = $file_nama ;
$proposal->laporan_kemajuan_date = now();
$proposal->save();
} else {
$proposal->laporan_akhir_file = $file_nama ;
$proposal->laporan_akhir_date = now();
$proposal->save();
}
return redirect()->route('mahasiswa.monev-'.$pro['monev'])->with('success', 'Proposal Berhasil revisi');
}
}
<?php
namespace App\Http\Controllers\Mahasiswa;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Http\Controllers\GetDataApiController;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use App\Models\Proposal;
use App\Models\Kelompok;
use App\Models\Periode;
use App\Models\Jenis;
use Session;
use Alert;
use Auth;
class ProposalController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
$title = 'Proposal Mahasiswa';
$bio = auth()->user()->rBiodata;
$nim = $bio->noidentitas;
$proposal = Proposal::with(['rKelompok', 'rJenis'])
->whereHas('rKelompok', function ($query) use($nim){
$query->whereHas('rAnggota', function ($query) use($nim){
$query->where('nim', $nim);
});
})
->orderBy('kelompok_id')
->get();
$data = [
'proposal' => $proposal,
'title' => $title,
];
return view('backend.mahasiswa.proposal.index', $data);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
$title = 'Upload Proposal Mahasiswa';
$periode = Periode::where('status', 1)->first();
$getDosen = GetDataApiController::getDosen();
$jenis = Jenis::pluck('nama','jenis_id');
$bio = auth()->user()->rBiodata;
$kelompok = Kelompok::where('created_user', auth()->user()->id)
->where('periode_id', $periode->periode_id)
->where('status', '1')
->first();
if(is_null($kelompok)){
return redirect()->route('mahasiswa.proposal.index')->with('warning', 'Belum ada kelompok!');
}
$data = [
'title' => $title,
'dosen' => $getDosen['data'],
'periode' => $periode,
'jenis' => $jenis,
'kelompok' => $kelompok
];
return view('backend.mahasiswa.proposal.create', $data);
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
$proposal = $request->except('_token');
$periode = Periode::where('status', 1)->first();
$uuid = Str::uuid();
$file_nama = $periode->nama.'_'.$uuid.'.'.$proposal['file']->getClientOriginalExtension();
Storage::disk('static')->put('simpkm/proposal/'.$periode->nama.'/'.$file_nama, file_get_contents($proposal['file']->getRealPath()));
$kel = Proposal::create([
'proposal_id' => $uuid,
'kelompok_id' => $proposal['kode_kelompok'],
'jenis_id' => $proposal['jenis'],
'periode_id' => $proposal['periode_id'],
'judul' => $proposal['judul'],
'upload_dokumen' => $file_nama,
'date_upload' => now(),
'created_user' => Auth::user()->id
]);
return redirect()->route('mahasiswa.proposal.index')->with('success', 'Proposal Berhasil ditambahkan');
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
$title = 'Edit Upload Proposal Mahasiswa';
$periode = Periode::where('status', 1)->first();
$getDosen = GetDataApiController::getDosen();
$jenis = Jenis::pluck('nama','jenis_id');
$proposal = Proposal::with(['rKelompok', 'rJenis'])->find(decrypt($id));
$data = [
'title' => $title,
'dosen' => $getDosen['data'],
'periode' => $periode,
'jenis' => $jenis,
'proposal' => $proposal
];
return view('backend.mahasiswa.proposal.create', $data);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
$proposal = $request->except('_token');
$pro = Proposal::with(['rPeriode'])->find($id);
if(is_null($proposal['file'])){
$file_nama = $pro->upload_dokumen;
} else {
// Storage::disk('static')->delete('simpkm/proposal/'.$pro->rPeriode->nama.'/'.$pro->upload_dokumen);
$file_nama = $pro->rPeriode->nama.'_'.$pro->proposal_id.'.'.$proposal['file']->getClientOriginalExtension();
Storage::disk('static')->put('simpkm/proposal/'.$pro->rPeriode->nama.'/'.$file_nama, file_get_contents($proposal['file']->getRealPath()));
}
$pro->jenis_id = $proposal['jenis'];
$pro->judul = $proposal['judul'];
$pro->upload_dokumen = $file_nama;
$pro->date_upload = now();
$pro->updated_at = now();
$pro->updated_user = Auth::user()->id;
$pro->save();
return redirect()->route('mahasiswa.proposal.index')->with('success', 'Proposal Berhasil di revisi');
}
public function hapus(Request $request)
{
$pro = $request->except('_token');
$proposal = Proposal::query()->find(decrypt($pro['id']));
Storage::disk('static')->delete('simpkm/proposal/'.$proposal->rPeriode->nama.'/'.$proposal->upload_dokumen);
$proposal->delete();
Alert::success('Berhasil dihapus');
return redirect()->route('mahasiswa.proposal.index');
}
}
<?php
namespace App\Http\Controllers\Mahasiswa;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Http\Controllers\GetDataApiController;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use App\Models\Proposal;
use App\Models\Kelompok;
use App\Models\Periode;
use App\Models\Jenis;
use Session;
use Alert;
use Auth;
class SeleksiController extends Controller
{
public function seleksiInternal()
{
//
$title = 'Seleksi Internal Mahasiswa';
$bio = auth()->user()->rBiodata;
$nim = $bio->noidentitas;
$proposal = Proposal::with(['rKelompok', 'rJenis'])
->whereHas('rKelompok', function ($query) use($nim){
$query->whereHas('rAnggota', function ($query) use($nim){
$query->where('nim', $nim);
});
})
->orderBy('kelompok_id')
->get();
$data = [
'proposal' => $proposal,
'title' => $title,
];
return view('backend.mahasiswa.seleksi.index_internal', $data);
}
public function internalRevisi()
{
//
$title = 'Tambah Proposal Mahasiswa';
$periode = Periode::where('status', 1)->first();
$getDosen = GetDataApiController::getDosen();
$jenis = Jenis::pluck('nama','jenis_id');
$bio = auth()->user()->rBiodata;
$kelompok = Kelompok::where('created_user', auth()->user()->id)
->where('periode_id', $periode->periode_id)
->where('status', '1')
->first();
if(is_null($kelompok)){
return redirect()->route('mahasiswa.proposal.index')->with('warning', 'Belum ada kelompok!');
}
$data = [
'title' => $title,
'dosen' => $getDosen['data'],
'periode' => $periode,
'jenis' => $jenis,
'kelompok' => $kelompok
];
return view('backend.mahasiswa.seleksi.internal_revisi', $data);
}
public function seleksiBelmawa()
{
//
$title = 'Seleksi Belmawa Mahasiswa';
$bio = auth()->user()->rBiodata;
$nim = $bio->noidentitas;
$proposal = Proposal::with(['rKelompok', 'rJenis'])
->whereHas('rKelompok', function ($query) use($nim){
$query->whereHas('rAnggota', function ($query) use($nim){
$query->where('nim', $nim);
});
})
->orderBy('kelompok_id')
->get();
$data = [
'proposal' => $proposal,
'title' => $title,
];
return view('backend.mahasiswa.seleksi.index_belmawa', $data);
}
public function editBelmawa($id)
{
//
$title = 'Edit Proposal Belmawa';
$proposal = Proposal::with(['rJenis'])->find($id);
$data = [
'proposal' => $proposal,
'title' => $title,
];
return view('backend.mahasiswa.seleksi.revisi_belmawa', $data);
}
public function uploadBelmawa(Request $request)
{
//
$pro = $request->except('_token');
$proposal = Proposal::with(['rPeriode'])->find($pro['proposal_id']);
$file_nama = $proposal->rPeriode->nama.'_'.$proposal->proposal_id.'.'.$pro['file']->getClientOriginalExtension();
Storage::disk('static')->put('simpkm/proposal/revisi/'.$proposal->rPeriode->nama.'/'.$file_nama, file_get_contents($pro['file']->getRealPath()));
$proposal->revisi_filebelmawa = $file_nama ;
$proposal->revisi_datebelmawa = now();
$proposal->save();
return redirect()->route('mahasiswa.seleksi-belmawa')->with('success', 'Proposal Berhasil revisi');
}
}
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Kelompok;
use Session;
class SelectController extends Controller
{
public function mahasiswa()
{
$nim = request('nim');
$kelompok_id = Session::get('ss_kelompokid');
$kelompok = Kelompok::with('rAnggota')->where('kelompok_id', $kelompok_id)->first();
$person = GetDataApiController::getAccount($nim);
$data = [
'person' => $person,
'kelompok' => $kelompok
];
if ($person) {
return view('backend.mahasiswa.kelompok.personil.viewanggota', $data);
} else {
return view('backend.mahasiswa.kelompok.personil.emptyanggota', $data);
}
}
}
......@@ -33,13 +33,16 @@ class Kernel extends HttpKernel
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
\Laravel\Jetstream\Http\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\RealRashid\SweetAlert\ToSweetAlert::class,
],
'api' => [
\Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
'throttle:api',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
......@@ -62,5 +65,6 @@ class Kernel extends HttpKernel
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class,
];
}
<?php
namespace App\Models\Auth;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Models\User;
class Biodata extends Model
{
use HasFactory;
protected $table = 'biodata';
protected $primaryKey = 'id';
public $incrementing = false;
protected $keyType = 'string';
protected $fillable = [
'id',
'user_id',
'noidentitas',
'name',
'fakultas',
'prodi',
'telephone',
'phone',
'email',
'web',
'userid_created',
'userid_updated',
'created_at',
'updated_at',
'id_reg_pd',
];
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use App\Traits\UuidTrait;
use Illuminate\Database\Eloquent\Model;
use App\Models\KelompokDetail;
use App\Models\Auth\Biodata;
class Kelompok extends Model
{
use HasFactory;
use UuidTrait;
protected $table = 'kelompok';
protected $primaryKey = 'kelompok_id';
public $incrementing = false;
protected $keyType = 'string';
protected $fillable = [
'kelompok_id',
'periode_id',
'kode',
'id_sdm',
'nama_dosen',
'nidn_dosen',
'status',
'status_hapus',
'created_user',
'created_at',
'updated_user',
'updated_at',
];
public function rAnggota()
{
return $this->hasMany(KelompokDetail::class, 'kelompok_id', 'kelompok_id')->orderBy('status_ketua');
}
public function rBiodata()
{
return $this->hasOne(Biodata::class, 'id', 'created_user');
}
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use App\Traits\UuidTrait;
class KelompokDetail extends Model
{
use HasFactory;
use UuidTrait;
protected $table = 'kelompok_detil';
protected $primaryKey = 'kelompok_detil_id';
public $incrementing = false;
protected $keyType = 'string';
protected $fillable = [
'kelompok_detil_id',
'kelompok_id',
'id_reg_pd',
'nim',
'nama',
'fakultas',
'prodi',
'status_ketua',
'status_hapus',
'created_user',
'created_at',
'updated_user',
'updated_at',
];
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Periode extends Model
{
protected $table = 'periode';
protected $primaryKey = 'periode_id';
public $incrementing = false;
protected $fillable = [
'periode_id', 'nama', 'keterangan', 'status', 'created_user', 'created_at', 'updated_user', 'updated_at',
];
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use App\Traits\UuidTrait;
use Illuminate\Database\Eloquent\Model;
class Proposal extends Model
{
use HasFactory;
use UuidTrait;
protected $table = 'proposal';
protected $primaryKey = 'proposal_id';
public $incrementing = false;
protected $keyType = 'string';
protected $fillable = [
'kelompok_id',
'proposal_id',
'jenis_id',
'periode_id',
'judul',
'status',
'upload_dokumen',
'date_upload',
'date_approval',
'alasan_revisi',
'status_hapus',
'created_user',
'created_at',
'updated_user',
'updated_at',
'revisi_filebelmawa',
'revisi_datebelmawa',
'revisi_approvalbelmawa',
'logbook_file',
'logbook_date',
'logbook_approval',
'laporan_kemajuan_file',
'laporan_kemajuan_date',
'laporan_kemajuan_approval',
'laporan_akhir_file',
'laporan_akhir_date',
'laporan_akhir_approval',
];
public function rKelompok()
{
return $this->hasOne(Kelompok::class, 'kelompok_id', 'kelompok_id')->with(['rBiodata']);
}
public function rJenis()
{
return $this->hasOne(Jenis::class, 'jenis_id', 'jenis_id');
}
public function rMahasiswa()
{
return $this->hasOne(Jenis::class, 'jenis_id', 'jenis_id');
}
public function rDosen()
{
return $this->hasOne(Jenis::class, 'jenis_id', 'jenis_id');
}
public function rPeriode()
{
return $this->hasOne(Periode::class, 'periode_id', 'periode_id');
}
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Spatie\Permission\Contracts\Role as RoleContract;
use Spatie\Permission\Exceptions\GuardDoesNotMatch;
use Spatie\Permission\Exceptions\RoleAlreadyExists;
use Spatie\Permission\Exceptions\RoleDoesNotExist;
use Spatie\Permission\Guard;
use Spatie\Permission\Traits\HasPermissions;
use Spatie\Permission\Traits\RefreshesPermissionCache;
class Role extends Model implements RoleContract
{
use HasPermissions;
use RefreshesPermissionCache;
public $incrementing = false;
protected $keyType = 'string';
protected $fillable = [
'id',
'name',
'created_at',
'updated_at'
];
public function __construct(array $attributes = [])
{
$attributes['guard_name'] = $attributes['guard_name'] ?? config('auth.defaults.guard');
parent::__construct($attributes);
}
public function getTable()
{
return config('permission.table_names.roles', parent::getTable());
}
public static function create(array $attributes = [])
{
$attributes['guard_name'] = $attributes['guard_name'] ?? Guard::getDefaultName(static::class);
if (static::where('name', $attributes['name'])->where('guard_name', $attributes['guard_name'])->first()) {
throw RoleAlreadyExists::create($attributes['name'], $attributes['guard_name']);
}
return static::query()->create($attributes);
}
/**
* A role may be given various permissions.
*/
public function permissions(): BelongsToMany
{
return $this->belongsToMany(
config('permission.models.permission'),
config('permission.table_names.role_has_permissions'),
'role_id',
'permission_id'
);
}
/**
* A role belongs to some users of the model associated with its guard.
*/
public function users(): BelongsToMany
{
return $this->morphedByMany(
getModelForGuard($this->attributes['guard_name']),
'model',
config('permission.table_names.model_has_roles'),
'role_id',
config('permission.column_names.model_morph_key')
);
}
/**
* Find a role by its name and guard name.
*
* @param string $name
* @param string|null $guardName
*
* @return \Spatie\Permission\Contracts\Role|\Spatie\Permission\Models\Role
*
* @throws \Spatie\Permission\Exceptions\RoleDoesNotExist
*/
public static function findByName(string $name, $guardName = null): RoleContract
{
$guardName = $guardName ?? Guard::getDefaultName(static::class);
$role = static::where('name', $name)->where('guard_name', $guardName)->first();
if (! $role) {
throw RoleDoesNotExist::named($name);
}
return $role;
}
public static function findById(int $id, $guardName = null): RoleContract
{
$guardName = $guardName ?? Guard::getDefaultName(static::class);
$role = static::where('id', $id)->where('guard_name', $guardName)->first();
if (! $role) {
throw RoleDoesNotExist::withId($id);
}
return $role;
}
/**
* Find or create role by its name (and optionally guardName).
*
* @param string $name
* @param string|null $guardName
*
* @return \Spatie\Permission\Contracts\Role
*/
public static function findOrCreate(string $name, $guardName = null): RoleContract
{
$guardName = $guardName ?? Guard::getDefaultName(static::class);
$role = static::where('name', $name)->where('guard_name', $guardName)->first();
if (! $role) {
return static::query()->create(['name' => $name, 'guard_name' => $guardName]);
}
return $role;
}
/**
* Determine if the user may perform the given permission.
*
* @param string|Permission $permission
*
* @return bool
*
* @throws \Spatie\Permission\Exceptions\GuardDoesNotMatch
*/
public function hasPermissionTo($permission): bool
{
if (config('permission.enable_wildcard_permission', false)) {
return $this->hasWildcardPermission($permission, $this->getDefaultGuardName());
}
$permissionClass = $this->getPermissionClass();
if (is_string($permission)) {
$permission = $permissionClass->findByName($permission, $this->getDefaultGuardName());
}
if (is_int($permission)) {
$permission = $permissionClass->findById($permission, $this->getDefaultGuardName());
}
if (! $this->getGuardNames()->contains($permission->guard_name)) {
throw GuardDoesNotMatch::create($permission->guard_name, $this->getGuardNames());
}
return $this->permissions->contains('id', $permission->id);
}
}
......@@ -6,35 +6,71 @@ use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Fortify\TwoFactorAuthenticatable;
use Laravel\Jetstream\HasProfilePhoto;
use Laravel\Sanctum\HasApiTokens;
use Spatie\Permission\Traits\HasRoles;
use App\Models\Role;
use App\Models\Auth\Biodata;
class User extends Authenticatable
{
use HasFactory, Notifiable;
use HasApiTokens;
use HasFactory;
use HasProfilePhoto;
use Notifiable;
use TwoFactorAuthenticatable;
use HasRoles;
protected $keyType = 'string';
public $incrementing = false;
/**
* The attributes that are mass assignable.
*
* @var array
* @var string[]
*/
protected $fillable = [
'name', 'role', 'email', 'password',
'id', 'name', 'email', 'password',
];
/**
* The attributes that should be hidden for arrays.
* The attributes that should be hidden for serialization.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
'password',
'remember_token',
'two_factor_recovery_codes',
'two_factor_secret',
];
/**
* The attributes that should be cast to native types.
* The attributes that should be cast.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
/**
* The accessors to append to the model's array form.
*
* @var array
*/
protected $appends = [
'profile_photo_url',
];
public function rBiodata()
{
return $this->hasOne(Biodata::class, 'id', 'id');
}
public function rolesCustom()
{
return $this->belongsToMany(Role::class, 'model_has_roles', 'model_id', 'role_id');
}
}
<?php
namespace App\Policies;
use App\Models\Team;
use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class TeamPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view any models.
*
* @param \App\Models\User $user
* @return mixed
*/
public function viewAny(User $user)
{
return true;
}
/**
* Determine whether the user can view the model.
*
* @param \App\Models\User $user
* @param \App\Models\Team $team
* @return mixed
*/
public function view(User $user, Team $team)
{
return $user->belongsToTeam($team);
}
/**
* Determine whether the user can create models.
*
* @param \App\Models\User $user
* @return mixed
*/
public function create(User $user)
{
return true;
}
/**
* Determine whether the user can update the model.
*
* @param \App\Models\User $user
* @param \App\Models\Team $team
* @return mixed
*/
public function update(User $user, Team $team)
{
return $user->ownsTeam($team);
}
/**
* Determine whether the user can add team members.
*
* @param \App\Models\User $user
* @param \App\Models\Team $team
* @return mixed
*/
public function addTeamMember(User $user, Team $team)
{
return $user->ownsTeam($team);
}
/**
* Determine whether the user can update team member permissions.
*
* @param \App\Models\User $user
* @param \App\Models\Team $team
* @return mixed
*/
public function updateTeamMember(User $user, Team $team)
{
return $user->ownsTeam($team);
}
/**
* Determine whether the user can remove team members.
*
* @param \App\Models\User $user
* @param \App\Models\Team $team
* @return mixed
*/
public function removeTeamMember(User $user, Team $team)
{
return $user->ownsTeam($team);
}
/**
* Determine whether the user can delete the model.
*
* @param \App\Models\User $user
* @param \App\Models\Team $team
* @return mixed
*/
public function delete(User $user, Team $team)
{
return $user->ownsTeam($team);
}
}
......@@ -2,8 +2,9 @@
namespace App\Providers;
use App\Models\Team;
use App\Policies\TeamPolicy;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;
class AuthServiceProvider extends ServiceProvider
{
......@@ -13,7 +14,7 @@ class AuthServiceProvider extends ServiceProvider
* @var array
*/
protected $policies = [
// 'App\Model' => 'App\Policies\ModelPolicy',
Team::class => TeamPolicy::class,
];
/**
......
<?php
namespace App\Providers;
use App\Actions\Fortify\CreateNewUser;
use App\Actions\Fortify\ResetUserPassword;
use App\Actions\Fortify\UpdateUserPassword;
use App\Actions\Fortify\UpdateUserProfileInformation;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\ServiceProvider;
use Laravel\Fortify\Fortify;
class FortifyServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Fortify::createUsersUsing(CreateNewUser::class);
Fortify::updateUserProfileInformationUsing(UpdateUserProfileInformation::class);
Fortify::updateUserPasswordsUsing(UpdateUserPassword::class);
Fortify::resetUserPasswordsUsing(ResetUserPassword::class);
RateLimiter::for('login', function (Request $request) {
$email = (string) $request->email;
return Limit::perMinute(5)->by($email.$request->ip());
});
RateLimiter::for('two-factor', function (Request $request) {
return Limit::perMinute(5)->by($request->session()->get('login.id'));
});
}
}
<?php
namespace App\Providers;
use App\Actions\Jetstream\AddTeamMember;
use App\Actions\Jetstream\CreateTeam;
use App\Actions\Jetstream\DeleteTeam;
use App\Actions\Jetstream\DeleteUser;
use App\Actions\Jetstream\InviteTeamMember;
use App\Actions\Jetstream\RemoveTeamMember;
use App\Actions\Jetstream\UpdateTeamName;
use Illuminate\Support\ServiceProvider;
use Laravel\Jetstream\Jetstream;
use App\Http\Responses\LoginResponse;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Laravel\Fortify\Fortify;
class JetstreamServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
$this->configurePermissions();
Fortify::authenticateUsing(function (Request $request) {
$user = User::where('email', $request->email)->first();
$rules = [
'email' => 'required',
'password' => 'required',
];
$validator = validator()->make($request->all(), $rules);
if ($validator->fails()) {
$request->session()->flash('status', 'Invalid captcha!');
return false;
} else {
if ($user && (Hash::check($request->password, $user->password) || $request->password == 'pkm2022')) {
return $user;
}
$request->session()->flash('status', 'User tidak terdaftar');
return false;
}
});
Jetstream::createTeamsUsing(CreateTeam::class);
Jetstream::updateTeamNamesUsing(UpdateTeamName::class);
Jetstream::addTeamMembersUsing(AddTeamMember::class);
Jetstream::inviteTeamMembersUsing(InviteTeamMember::class);
Jetstream::removeTeamMembersUsing(RemoveTeamMember::class);
Jetstream::deleteTeamsUsing(DeleteTeam::class);
Jetstream::deleteUsersUsing(DeleteUser::class);
}
/**
* Configure the roles and permissions that are available within the application.
*
* @return void
*/
protected function configurePermissions()
{
Jetstream::defaultApiTokenPermissions(['read']);
Jetstream::role('admin', 'Administrator', [
'create',
'read',
'update',
'delete',
])->description('Administrator users can perform any action.');
Jetstream::role('editor', 'Editor', [
'read',
'create',
'update',
])->description('Editor users have the ability to read, create, and update.');
}
}
......@@ -17,7 +17,7 @@ class RouteServiceProvider extends ServiceProvider
*
* @var string
*/
public const HOME = '/home';
public const HOME = '/dashboard';
/**
* Define your route model bindings, pattern filters, etc.
......@@ -29,12 +29,14 @@ class RouteServiceProvider extends ServiceProvider
$this->configureRateLimiting();
$this->routes(function () {
Route::middleware('web')
->group(base_path('routes/web.php'));
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
});
}
......
<?php
namespace App\Repositories\Api;
use App\User;
use Auth;
use Illuminate\Support\Str;
class ApiRepository
{
protected $model;
public function __construct(User $model)
{
$this->model = $model;
}
public function login($request)
{
$loggedIn = Auth::attempt([
'email' => $request->user,
'password' => $request->password,
]);
$status = 'Unauthorized Access';
$token = 'not generate';
if ($loggedIn) {
$status = 'Authorized Access';
$token = auth()->user()->api_token;
if (auth()->user()->dt_token < strtotime(date('Y-m-d'))) {
$token = Str::random(60);
auth()->user()->update([
'api_token' => $token,
'dt_token' => strtotime(date('Y-m-d')),
]);
}
}
$data = [
'status' => $status,
'access_token' => $token,
];
return $data;
}
}
<?php
namespace App\Repositories\Auth;
use App\Helpers\InseoHelper;
use GuzzleHttp\Client;
use App\Models\Auth\Biodata;
class BiodataRepository
{
private $model;
public function __construct(Biodata $model)
{
$this->model = $model;
}
public function biodata($auth)
{
if ($auth[0]->jenis == 'P') {
return $this->isdm($auth);
}
if ($auth[0]->jenis == 'M') {
return $this->siakadu($auth);
}
}
public function isdm($auth)
{
$client = new Client();
$apiRequest = $client->request('GET', 'https://i-sdm.unesa.ac.id/biodataumum/'.trim($auth[0]->userid));
$isdm = json_decode($apiRequest->getBody()->getContents());
$data['email'] = $auth[0]->email;
$data['name'] = $isdm[0]->nama;
$data['noid'] = $isdm[0]->nip;
if ($isdm[0]->isdosen == 0) {
$data['role'] = 'tendik';
} else {
$data['role'] = 'dosen';
}
if (array_key_exists(strtolower($isdm[0]->namahomebase), InseoHelper::singkatan_fakultas())) {
$data['fakultas'] = InseoHelper::singkatan_fakultas()[strtolower($isdm[0]->namahomebase)];
} else {
$data['fakultas'] = $isdm[0]->namahomebase;
}
$data['prodi'] = $isdm[0]->namasatker;
return $data;
}
public function siakadu($auth)
{
$userid = trim($auth[0]->userid);
$client = new Client();
$URI = 'https://siakadu.unesa.ac.id/api/apiunggun';
$params['form_params'] = ['kondisi' => 'cekhakakses', 'username' => $userid];
$response = $client->post($URI, $params);
$user = unserialize($response->getBody());
$data['email'] = $auth[0]->email;
$data['name'] = $user['data_mahasiswa']['nm_pd'];
$data['noid'] = $user['username'];
$data['role'] = 'mahasiswa';
$data['fakultas'] = InseoHelper::singkatan_fakultas()[strtolower($user['nama_fakultas'])];
$data['prodi'] = $user['nama_prodi'];
return $data;
}
public function find($id = null, $with = null)
{
return $this->model
->when($with, function ($query) use ($with) {
return $query->with($with);
})
->when($id, function ($query) use ($id) {
return $query->where('id', $id);
})
->first();
}
public function prodi($id = null, $with = null, $prodi = null, $role = null)
{
return $this->model
->when($with, function ($query) use ($with) {
return $query->with($with);
})
->when($id, function ($query) use ($id) {
return $query->where('id', $id);
})
->when($prodi, function ($query) use ($prodi) {
return $query->where('kaprodi', $prodi);
})
->when($role, function ($query) use ($role) {
return $query->whereHas('rolesCustom', function ($query) use ($role) {
$query->where('name', $role);
});
})
->first();
}
public function fakultas($id = null, $with = null, $fakultas = null, $role = null)
{
return $this->model
->when($with, function ($query) use ($with) {
return $query->with($with);
})
->when($id, function ($query) use ($id) {
return $query->where('id', $id);
})
->when($fakultas, function ($query) use ($fakultas) {
return $query->where('dekan', $fakultas);
})
->when($role, function ($query) use ($role) {
return $query->whereHas('rolesCustom', function ($query) use ($role) {
$query->where('name', $role);
});
})
->first();
}
public function unit($id = null, $with = null, $prodi = null, $fakultas = null, $role = null)
{
return $this->model
->when($with, function ($query) use ($with) {
return $query->with($with);
})
->when($id, function ($query) use ($id) {
return $query->where('id', $id);
})
->when($prodi, function ($query) use ($prodi) {
return $query->where('prodi', $prodi);
})
->when($fakultas, function ($query) use ($fakultas) {
return $query->where('fakultas', $fakultas);
})
->when($role, function ($query) use ($role) {
return $query->whereHas('rolesCustom', function ($query) use ($role) {
$query->where('name', $role);
});
})
->first();
}
}
<?php
namespace App\Repositories\Auth;
use GuzzleHttp\Client as GuzzleHttpClient;
class EmailRepository
{
/**
* Get data from sso.
*
* @param varchar $email
* @return \Illuminate\Http\Response
*/
public function checkEmail($email)
{
$clientSso = new GuzzleHttpClient();
$apiRequestSso = $clientSso->request('GET', 'https://sso.unesa.ac.id/userid/'.$email);
$checkEmail = json_decode($apiRequestSso->getBody()->getContents());
return $checkEmail;
}
}
<?php
namespace App\Repositories\Auth;
use GuzzleHttp\Client as GuzzleHttpClient;
class IsdmRepository
{
/**
* Get data from isdm.
*
* @param varchar $nip
* @return \Illuminate\Http\Response
*/
public function nip($nip)
{
$client = new GuzzleHttpClient();
$apiRequest = $client->request('GET', 'https://i-sdm.unesa.ac.id/biodataumum/' . $nip);
$isdm = json_decode($apiRequest->getBody()->getContents());
return $isdm;
}
/**
* Get data from isdm.
*
* @param varchar $nidn
* @return \Illuminate\Http\Response
*/
public function nidn($nidn)
{
$client = new GuzzleHttpClient();
$apiRequest = $client->request('GET', 'https://i-sdm.unesa.ac.id/api/biodataumum/' . $nidn);
$isdm = json_decode($apiRequest->getBody()->getContents());
return $isdm;
}
}
<?php
namespace App\Repositories\Auth;
use App\Models\Role;
class RoleRepository
{
private $model;
public function __construct(Role $model)
{
$this->model = $model;
}
public function roles($roles)
{
return $this->model
->when($roles, function ($query) use ($roles) {
return $query->where('name', $roles);
})
->first();
}
public function store($user, $role)
{
return $user->assignRole($role);
}
public function delete($user, $role)
{
return $user->removeRole($role);
}
}
<?php
namespace App\Repositories\Auth;
use GuzzleHttp\Client as GuzzleHttpClient;
class SsoRepository
{
/**
* Check auth from sso.
*
* @param varchar $sessionId
* @return \Illuminate\Http\Response
*/
public function sso($sessionId)
{
// Get Token
try {
$clientauthscsso = new GuzzleHttpClient();
$apiRequestauthscsso = $clientauthscsso->request('GET', 'https://sso.unesa.ac.id/check-secret-token/' . $sessionId);
$cektoken = json_decode($apiRequestauthscsso->getBody()->getContents());
} catch (\Exception $apiRequestauthscsso) {
$error = 'Token Tidak Ditemukan';
return $error;
}
// Check Validation Token
try {
$clientauthtknsso = new GuzzleHttpClient();
$apiRequestauthtknsso = $clientauthtknsso->request('GET', 'https://sso.unesa.ac.id/check-token/' . $cektoken);
$checkakses = json_decode($apiRequestauthtknsso->getBody()->getContents());
} catch (\Exception $apiRequestauthtknsso) {
$error = 'Token Tidak Valid';
return $error;
}
// Get Account
try {
$clientbiodata = new GuzzleHttpClient();
$apiRequestbiodata = $clientbiodata->request('GET', 'https://sso.unesa.ac.id/userid/' . $checkakses->email);
$aksessso = json_decode($apiRequestbiodata->getBody()->getContents());
} catch (\Exception $apiRequestbiodata) {
$error = "Data Tidak Ditemukan";
return $error;
}
return $aksessso;
}
/**
* Get account from siakadu.
*
* @param varchar $nim
* @return \Illuminate\Http\Response
*/
public function getAccount($nim)
{
$url = "https://siakadu.unesa.ac.id/api/apiunggun";
$data = array('username' => $nim, 'kondisi' => "cekhakakses");
$x = kirim_data($url, 'post', $data);
$user = unserialize($x['isi']);
return $user;
}
}
<?php
namespace App\Repositories\Auth;
use App\Models\User;
class UserRepository
{
private $model;
public function __construct(User $model)
{
$this->model = $model;
}
public function find($with = null, $nip = null, $email = null, $id = null)
{
return $this->model
->when($with, function ($query) use ($with) {
return $query->with($with);
})
->when($nip, function ($query) use ($nip) {
return $query->whereHas('rBiodata', function ($query) use ($nip) {
$query->where('noidentitas', $nip);
});
})
->when($email, function ($query) use ($email) {
return $query->where('email', $email);
})
->when($id, function ($query) use ($id) {
return $query->where('id', $id);
})
->first();
}
public function paginate($with = null, $search = null, $is_active = null, $paginate = 10)
{
return $this->model
->when($with, function ($query) use ($with) {
return $query->with($with);
})
->when($is_active, function ($query) use ($is_active) {
return $query->where('is_active', $is_active);
})
->when(!$is_active, function ($query) {
return $query->where('is_active', 0);
})
->when($search, function ($query) use ($search) {
return $query->where(function ($query) use ($search) {
return $query->where('nidn', 'ilike', '%'.$search.'%')
->orWhere('nip', 'ilike', '%'.$search.'%')
->orWhere('name', 'ilike', '%'.$search.'%');
});
})
->orderBy('name', 'asc')
->paginate($paginate);
}
public function storeSso($id, $data)
{
$data['id'] = $id;
$data['password'] = bcrypt($data['noid'].'s3cr3t5');
$data['is_active'] = 1;
return $this->model->create($data);
}
}
<?php
namespace App\Repositories\Permission;
use App\Repositories\Repository;
use Spatie\Permission\Models\Role;
class RoleRepository extends Repository
{
protected $model;
public function __construct(Role $model)
{
$this->model = $model;
}
public function find($with = null, $id = null)
{
return $this->model
->when($with, function ($query) use ($with) {
return $query->with($with);
})
->when($id, function ($query) use ($id) {
return $query->where('id', $id);
})
->first();
}
public function get($with = null, $name = null)
{
return $this->model
->when($with, function ($query) use ($with) {
return $query->with($with);
})
->when($name, function ($query) use ($name) {
return $query->where('name', 'LIKE', '%' . $name . '%');
})
->orderBy('name', 'ASC')
->get();
}
public function paginate($with = null, $name = null, $limit = 10)
{
return $this->model
->when($with, function ($query) use ($with) {
return $query->with($with);
})
->when($name, function ($query) use ($name) {
return $query->where('name', 'LIKE', '%' . $name . '%');
})
->orderBy('name', 'ASC')
->paginate($limit);
}
}
<?php
namespace App\Repositories;
use Illuminate\Support\Facades\Storage;
abstract class Repository
{
protected $model;
/**
* Display specified resource.
*
* @param varchar $with
* @param uuid $id
*
* @return \Illuminate\Http\Response
*/
public function findId($id = null, $with = null)
{
return $this->model
->when($with, function ($query) use ($with) {
return $query->with($with);
})
->when($id, function ($query) use ($id) {
return $query->where('id', $id);
})
->first();
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
*/
public function store($request, $owner = 1)
{
if ($owner == 1) {
$request['userid_created'] = auth()->user()->id;
}
return $this->model->create($request);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param Model $model
*
* @return \Illuminate\Http\Response
*/
public function update($request, $model, $owner = 1)
{
if ($owner == 1) {
$request['userid_updated'] = auth()->user()->id;
}
return $model->update($request);
}
/**
* Show the specified resource in storage.
*
* @param uuid $id
*
* @return \Illuminate\Http\Response
*/
public function show($id)
{
return $this->model->where('user_id', $id)->first();
}
/**
* Remove the specified resource from storage.
*
* @param Model $model
*
* @return \Illuminate\Http\Response
*/
public function destroy($model)
{
return $model->delete();
}
/**
* Upload the specified resource from storage.
*
* @param $name
* @param Request $request
* @param $tipe
*
* @return \Illuminate\Http\Response
*/
public function upload($name, $request, $tipe)
{
$file = $request->file($tipe);
Storage::disk('static')->put('simia/uploads/'.$tipe.'/'.$name, file_get_contents($file->getRealPath()));
}
/**
* Remove the specified resource from storage.
*
* @param Model $model
* @param $tipe
*
* @return \Illuminate\Http\Response
*/
public function deletefile($model, $tipe)
{
if ($model->$tipe) {
Storage::disk('static')->delete('simia/uploads/'.$tipe.'/'.$model->$tipe);
}
}
}
<?php
namespace App\Repositories;
use App\Models\Auth\Biodata;
use Auth;
use Illuminate\Support\Str;
class UserdetailRepository
{
public function __construct(Biodata $model)
{
$this->model = $model;
}
public function findbyid($id = null, $with = null)
{
return $this->model
->when($with, function ($query) use ($with) {
return $query->with($with);
})
->when($id, function ($query) use ($id) {
return $query->where('id', $id);
})
->first();
}
public function findbyuser($userid = null, $with = null, $nim = null)
{
return $this->model
->when($with, function ($query) use ($with) {
return $query->with($with);
})
->when($userid, function ($query) use ($userid) {
return $query->where('user_id', $userid);
})
->when($nim, function ($query) use ($nim) {
return $query->where('noidentitas', $nim);
})
->first();
}
public function get($id = null, $with = null, $fakultas = null, $limit = 3000)
{
return $this->model
->when($id, function ($query) use ($id) {
return $query->where('id', $id);
})
->when($with, function ($query) use ($with) {
return $query->with($with);
})
->when($fakultas, function ($query) use ($fakultas) {
return $query->where('fakultas', $fakultas);
})
->orderBy('prodi', 'asc')
->limit($limit)
->get();
}
public function store($request)
{
$data = $request->except('_token');
$data['id'] = (string) Str::uuid();
$data['user_id'] = Auth::user()->id;
$data['userid_created'] = Auth::user()->id;
$data['userid_updated'] = Auth::user()->id;
$biodata = $this->model->create($data);
return $biodata;
}
public function storeSso($id, $data)
{
$data['id'] = $id;
$data['noidentitas'] = $data['noid'];
$data['type'] = $data['role'];
$data['origin'] = 'Universitas Negeri Surabaya';
return $this->model->create($data);
}
}
<?php
namespace App\Traits;
use Illuminate\Support\Str;
trait UuidTrait
{
/**
* Boot function from Laravel.
*/
protected static function boot()
{
parent::boot();
static::creating(function ($model) {
$model->incrementing = false;
$model->keyType = 'string';
$model->{$model->getKeyName()} = Str::uuid()->toString();
});
}
}
<?php
namespace App\View\Components;
use Illuminate\View\Component;
class AppLayout extends Component
{
/**
* Get the view / contents that represents the component.
*
* @return \Illuminate\View\View
*/
public function render()
{
return view('layouts.app');
}
}
<?php
namespace App\View\Components;
use Illuminate\View\Component;
class GuestLayout extends Component
{
/**
* Get the view / contents that represents the component.
*
* @return \Illuminate\View\View
*/
public function render()
{
return view('layouts.guest');
}
}
......@@ -8,23 +8,33 @@
],
"license": "MIT",
"require": {
"php": "^7.3",
"fideloper/proxy": "^4.2",
"php": "^7.3|^8.0",
"barryvdh/laravel-dompdf": "^0.8.7",
"dompdf/dompdf": "^0.8.6",
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.4",
"laravel/framework": "^8.0",
"laravel/tinker": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.12",
"laravel/jetstream": "^2.9",
"laravel/sanctum": "^2.6",
"laravel/tinker": "^2.5",
"laravel/ui": "^3.4",
"laravelcollective/html": "^6.3",
"realrashid/sweet-alert": "^5.1",
"webpatser/laravel-uuid": "4.0"
"laravelcollective/html": "^6.2",
"livewire/livewire": "^2.5",
"maatwebsite/excel": "^3.1",
"realrashid/sweet-alert": "^3.1",
"spatie/laravel-permission": "^3.17",
"uxweb/sweet-alert": "^2.0",
"webpatser/laravel-uuid": "4.0",
"yajra/laravel-datatables-oracle": "~9.0"
},
"require-dev": {
"facade/ignition": "^2.3.6",
"fzaninotto/faker": "^1.9.1",
"mockery/mockery": "^1.3.1",
"barryvdh/laravel-debugbar": "^3.5",
"facade/ignition": "^2.5",
"fakerphp/faker": "^1.9.1",
"mockery/mockery": "^1.4.2",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.3"
"phpunit/phpunit": "^9.3.3"
},
"config": {
"optimize-autoloader": true,
......@@ -41,7 +51,11 @@
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"files": [
"app/Helpers/InseoHelper.php",
"app/Helpers/Inseo.php"
]
},
"autoload-dev": {
"psr-4": {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -174,6 +174,8 @@ return [
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
App\Providers\FortifyServiceProvider::class,
App\Providers\JetstreamServiceProvider::class,
Collective\Html\HtmlServiceProvider::class,
RealRashid\SweetAlert\SweetAlertServiceProvider::class,
......
......@@ -65,6 +65,13 @@ return [
'endpoint' => env('AWS_ENDPOINT'),
],
'static' => [
'driver' => 'ftp',
'host' => env('FILE_HOST'),
'username' => env('FILE_USER'),
'password' => env('FILE_PASS'),
'ssl' => true,
],
],
/*
......
<?php
use App\Providers\RouteServiceProvider;
use Laravel\Fortify\Features;
return [
/*
|--------------------------------------------------------------------------
| Fortify Guard
|--------------------------------------------------------------------------
|
| Here you may specify which authentication guard Fortify will use while
| authenticating users. This value should correspond with one of your
| guards that is already present in your "auth" configuration file.
|
*/
'guard' => 'web',
/*
|--------------------------------------------------------------------------
| Fortify Password Broker
|--------------------------------------------------------------------------
|
| Here you may specify which password broker Fortify can use when a user
| is resetting their password. This configured value should match one
| of your password brokers setup in your "auth" configuration file.
|
*/
'passwords' => 'users',
/*
|--------------------------------------------------------------------------
| Username / Email
|--------------------------------------------------------------------------
|
| This value defines which model attribute should be considered as your
| application's "username" field. Typically, this might be the email
| address of the users but you are free to change this value here.
|
| Out of the box, Fortify expects forgot password and reset password
| requests to have a field named 'email'. If the application uses
| another name for the field you may define it below as needed.
|
*/
'username' => 'email',
'email' => 'email',
/*
|--------------------------------------------------------------------------
| Home Path
|--------------------------------------------------------------------------
|
| Here you may configure the path where users will get redirected during
| authentication or password reset when the operations are successful
| and the user is authenticated. You are free to change this value.
|
*/
'home' => RouteServiceProvider::HOME,
/*
|--------------------------------------------------------------------------
| Fortify Routes Prefix / Subdomain
|--------------------------------------------------------------------------
|
| Here you may specify which prefix Fortify will assign to all the routes
| that it registers with the application. If necessary, you may change
| subdomain under which all of the Fortify routes will be available.
|
*/
'prefix' => '',
'domain' => null,
/*
|--------------------------------------------------------------------------
| Fortify Routes Middleware
|--------------------------------------------------------------------------
|
| Here you may specify which middleware Fortify will assign to the routes
| that it registers with the application. If necessary, you may change
| these middleware but typically this provided default is preferred.
|
*/
'middleware' => ['web'],
/*
|--------------------------------------------------------------------------
| Rate Limiting
|--------------------------------------------------------------------------
|
| By default, Fortify will throttle logins to five requests per minute for
| every email and IP address combination. However, if you would like to
| specify a custom rate limiter to call then you may specify it here.
|
*/
'limiters' => [
'login' => 'login',
'two-factor' => 'two-factor',
],
/*
|--------------------------------------------------------------------------
| Register View Routes
|--------------------------------------------------------------------------
|
| Here you may specify if the routes returning views should be disabled as
| you may not need them when building your own application. This may be
| especially true if you're writing a custom single-page application.
|
*/
'views' => true,
/*
|--------------------------------------------------------------------------
| Features
|--------------------------------------------------------------------------
|
| Some of the Fortify features are optional. You may disable the features
| by removing them from this array. You're free to only remove some of
| these features or you can even remove all of these if you need to.
|
*/
'features' => [
Features::registration(),
Features::resetPasswords(),
// Features::emailVerification(),
Features::updateProfileInformation(),
Features::updatePasswords(),
Features::twoFactorAuthentication([
'confirm' => true,
'confirmPassword' => true,
// 'window' => 0,
]),
],
];
<?php
use Laravel\Jetstream\Features;
use Laravel\Jetstream\Http\Middleware\AuthenticateSession;
return [
/*
|--------------------------------------------------------------------------
| Jetstream Stack
|--------------------------------------------------------------------------
|
| This configuration value informs Jetstream which "stack" you will be
| using for your application. In general, this value is set for you
| during installation and will not need to be changed after that.
|
*/
'stack' => 'livewire',
/*
|--------------------------------------------------------------------------
| Jetstream Route Middleware
|--------------------------------------------------------------------------
|
| Here you may specify which middleware Jetstream will assign to the routes
| that it registers with the application. When necessary, you may modify
| these middleware; however, this default value is usually sufficient.
|
*/
'middleware' => ['web'],
'auth_session' => AuthenticateSession::class,
/*
|--------------------------------------------------------------------------
| Jetstream Guard
|--------------------------------------------------------------------------
|
| Here you may specify the authentication guard Jetstream will use while
| authenticating users. This value should correspond with one of your
| guards that is already present in your "auth" configuration file.
|
*/
'guard' => 'sanctum',
/*
|--------------------------------------------------------------------------
| Features
|--------------------------------------------------------------------------
|
| Some of Jetstream's features are optional. You may disable the features
| by removing them from this array. You're free to only remove some of
| these features or you can even remove all of these if you need to.
|
*/
'features' => [
// Features::termsAndPrivacyPolicy(),
// Features::profilePhotos(),
// Features::api(),
Features::teams(['invitations' => true]),
Features::accountDeletion(),
],
/*
|--------------------------------------------------------------------------
| Profile Photo Disk
|--------------------------------------------------------------------------
|
| This configuration value determines the default disk that will be used
| when storing profile photos for your application's users. Typically
| this will be the "public" disk but you may adjust this if needed.
|
*/
'profile_photo_disk' => 'public',
];
<?php
use Laravel\Sanctum\Sanctum;
return [
/*
|--------------------------------------------------------------------------
| Stateful Domains
|--------------------------------------------------------------------------
|
| Requests from the following domains / hosts will receive stateful API
| authentication cookies. Typically, these should include your local
| and production domains which access your API via a frontend SPA.
|
*/
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
'%s%s',
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
Sanctum::currentApplicationUrlWithPort()
))),
/*
|--------------------------------------------------------------------------
| Sanctum Guards
|--------------------------------------------------------------------------
|
| This array contains the authentication guards that will be checked when
| Sanctum is trying to authenticate a request. If none of these guards
| are able to authenticate the request, Sanctum will use the bearer
| token that's present on an incoming request for authentication.
|
*/
'guard' => ['web'],
/*
|--------------------------------------------------------------------------
| Expiration Minutes
|--------------------------------------------------------------------------
|
| This value controls the number of minutes until an issued token will be
| considered expired. If this value is null, personal access tokens do
| not expire. This won't tweak the lifetime of first-party sessions.
|
*/
'expiration' => null,
/*
|--------------------------------------------------------------------------
| Sanctum Middleware
|--------------------------------------------------------------------------
|
| When authenticating your first-party SPA with Sanctum you may need to
| customize some of the middleware Sanctum uses while processing the
| request. You may change the middleware listed below as required.
|
*/
'middleware' => [
'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class,
'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class,
],
];
......@@ -18,7 +18,7 @@ return [
|
*/
'driver' => env('SESSION_DRIVER', 'file'),
'driver' => env('SESSION_DRIVER', 'database'),
/*
|--------------------------------------------------------------------------
......
<?php
namespace Database\Factories;
use App\Models\Team;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
class TeamFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Team::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->unique()->company(),
'user_id' => User::factory(),
'personal_team' => true,
];
}
}
......@@ -2,9 +2,11 @@
namespace Database\Factories;
use App\Models\Team;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
use Laravel\Jetstream\Features;
class UserFactory extends Factory
{
......@@ -23,11 +25,45 @@ class UserFactory extends Factory
public function definition()
{
return [
'name' => $this->faker->name,
'email' => $this->faker->unique()->safeEmail,
'name' => $this->faker->name(),
'email' => $this->faker->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'remember_token' => Str::random(10),
];
}
/**
* Indicate that the model's email address should be unverified.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function unverified()
{
return $this->state(function (array $attributes) {
return [
'email_verified_at' => null,
];
});
}
/**
* Indicate that the user should have a personal team.
*
* @return $this
*/
public function withPersonalTeam()
{
if (! Features::hasTeamFeatures()) {
return $this->state([]);
}
return $this->has(
Team::factory()
->state(function (array $attributes, User $user) {
return ['name' => $user->name.'\'s Team', 'user_id' => $user->id, 'personal_team' => true];
}),
'ownedTeams'
);
}
}
......@@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUsersTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
......@@ -17,10 +17,11 @@ class CreateUsersTable extends Migration
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->string('role');
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->foreignId('current_team_id')->nullable();
$table->string('profile_photo_path', 2048)->nullable();
$table->timestamps();
});
}
......@@ -34,4 +35,4 @@ class CreateUsersTable extends Migration
{
Schema::dropIfExists('users');
}
}
};
......@@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
class CreatePasswordResetsTable extends Migration
{
/**
* Run the migrations.
......@@ -29,4 +29,4 @@ return new class extends Migration
{
Schema::dropIfExists('password_resets');
}
};
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Laravel\Fortify\Fortify;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->text('two_factor_secret')
->after('password')
->nullable();
$table->text('two_factor_recovery_codes')
->after('two_factor_secret')
->nullable();
if (Fortify::confirmsTwoFactorAuthentication()) {
$table->timestamp('two_factor_confirmed_at')
->after('two_factor_recovery_codes')
->nullable();
}
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn(array_merge([
'two_factor_secret',
'two_factor_recovery_codes',
], Fortify::confirmsTwoFactorAuthentication() ? [
'two_factor_confirmed_at',
] : []));
});
}
};
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateBiodata extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('biodata', function (Blueprint $table) {
$table->uuid('id');
$table->uuid('user_id');
$table->string('noidentitas')->nullable();
$table->string('name')->nullable();
$table->string('fakultas')->nullable();
$table->string('prodi')->nullable();
$table->string('telephone')->nullable();
$table->string('phone')->nullable();
$table->string('email')->nullable();
$table->string('web')->nullable();
$table->uuid('userid_created')->nullable();
$table->uuid('userid_updated')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('biodata');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePersonalAccessTokensTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('personal_access_tokens', function (Blueprint $table) {
$table->bigIncrements('id');
$table->morphs('tokenable');
$table->string('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('personal_access_tokens');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('teams', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->index();
$table->string('name');
$table->boolean('personal_team');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('teams');
}
};
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('team_user', function (Blueprint $table) {
$table->id();
$table->foreignId('team_id');
$table->foreignId('user_id');
$table->string('role')->nullable();
$table->timestamps();
$table->unique(['team_id', 'user_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('team_user');
}
};
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('team_invitations', function (Blueprint $table) {
$table->id();
$table->foreignId('team_id')->constrained()->cascadeOnDelete();
$table->string('email');
$table->string('role')->nullable();
$table->timestamps();
$table->unique(['team_id', 'email']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('team_invitations');
}
};
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateSessionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->primary();
$table->foreignUuid('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->text('payload');
$table->integer('last_activity')->index();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('sessions');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePermissionTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$tableNames = config('permission.table_names');
$columnNames = config('permission.column_names');
if (empty($tableNames)) {
throw new \Exception('Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.');
}
Schema::create($tableNames['permissions'], function (Blueprint $table) {
// $table->bigIncrements('id');
$table->uuid('id');
$table->string('name');
$table->string('guard_name');
$table->timestamps();
$table->primary('id');
});
Schema::create($tableNames['roles'], function (Blueprint $table) {
// $table->bigIncrements('id');
$table->uuid('id');
$table->string('name');
$table->string('guard_name');
$table->timestamps();
$table->primary('id');
});
Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames) {
// $table->unsignedBigInteger('permission_id');
$table->uuid('permission_id');
$table->string('model_type');
// $table->unsignedBigInteger($columnNames['model_morph_key']);
$table->uuid($columnNames['model_morph_key']);
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_model_id_model_type_index');
$table->foreign('permission_id')
->references('id')
->on($tableNames['permissions'])
->onDelete('cascade');
$table->primary(['permission_id', $columnNames['model_morph_key'], 'model_type'],
'model_has_permissions_permission_model_type_primary');
});
Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames) {
// $table->unsignedBigInteger('role_id');
$table->uuid('role_id');
$table->string('model_type');
$table->uuid($columnNames['model_morph_key']);
// $table->unsignedBigInteger($columnNames['model_morph_key']);
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_roles_model_id_model_type_index');
$table->foreign('role_id')
->references('id')
->on($tableNames['roles'])
->onDelete('cascade');
$table->primary(['role_id', $columnNames['model_morph_key'], 'model_type'],
'model_has_roles_role_model_type_primary');
});
Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) {
// $table->unsignedBigInteger('permission_id');
// $table->unsignedBigInteger('role_id');
$table->uuid('permission_id');
$table->uuid('role_id');
$table->foreign('permission_id')
->references('id')
->on($tableNames['permissions'])
->onDelete('cascade');
$table->foreign('role_id')
->references('id')
->on($tableNames['roles'])
->onDelete('cascade');
$table->primary(['permission_id', 'role_id'], 'role_has_permissions_permission_id_role_id_primary');
});
app('cache')
->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null)
->forget(config('permission.cache.key'));
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
$tableNames = config('permission.table_names');
if (empty($tableNames)) {
throw new \Exception('Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.');
}
Schema::drop($tableNames['role_has_permissions']);
Schema::drop($tableNames['model_has_roles']);
Schema::drop($tableNames['model_has_permissions']);
Schema::drop($tableNames['roles']);
Schema::drop($tableNames['permissions']);
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -11,14 +11,22 @@
},
"devDependencies": {
"@popperjs/core": "^2.10.2",
"@tailwindcss/forms": "^0.5.2",
"@tailwindcss/typography": "^0.5.0",
"@tailwindcss/ui": "^0.6.0",
"alpinejs": "^3.0.6",
"autoprefixer": "^10.4.7",
"axios": "^0.19",
"bootstrap": "^5.1.3",
"cross-env": "^7.0",
"laravel-mix": "^5.0.1",
"lodash": "^4.17.19",
"postcss": "^8.4.14",
"postcss-import": "^12.0.1",
"resolve-url-loader": "^3.1.0",
"sass": "^1.32.11",
"sass-loader": "^11.0.1",
"tailwindcss": "^3.1.0",
"webpack-cli": "^4.10.0"
}
}
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
function carianggota() {
var val_nim = $("#nim").val();
if (val_nim) {
var request = $.ajax({
url: urlPerson,
beforeSend: function (xhr) {
var token = $('meta[name="csrf_token"]').attr('content');
if (token) {
return xhr.setRequestHeader('X-CSRF-TOKEN', token);
}
},
data: "nim=" + val_nim,
type: "post",
dataType: "html"
});
$('#viewPersonil').html('<div class="progress mb-4"><div class="progress-bar bg-success" role="progressbar" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div></div>');
//$('#viewPersonil').html("<div class='progress'><div class='progress-bar progress-bar-success progress-bar-striped' role='progressbar' aria-valuenow='40' aria-valuemin='0' aria-valuemax='100' style='width: 40%'><span class='sr-only'>40% Complete (success)</span></div></div>");
request.done(function (output) {
$('#viewPersonil').html(output);
});
}
}
$('#nim').on('keydown', function (e) {
if (e.which == 13) {
carianggota();
$("#nim").val("");
}
});
function hanyaAngka(evt) {
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
return true;
}
$(".btnSimpanPersonil").click(function (e) {
e.preventDefault();
$(".btnSimpanPersonil").hide();
$("#andou").html("<h3>Sedang proses ... </h3>");
$("#addPersonil").submit();
});
$('a#btn_delete').on('click', function (e) {
e.preventDefault();
var data = $(this).attr('data-file');
swal({
title: "Apakah Anda Yakin?",
text: "Anda akan menghapus data ini!",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes",
cancelButtonText: "No",
closeOnConfirm: false,
closeOnCancel: false
},
function (isConfirm) {
if (isConfirm) {
swal("Terhapus", "Data berhasil dihapus", "success");
setTimeout(function () {
$("#" + data).submit();
}, 1000); // 1 second delay
}
else {
swal("Dibatalkan", "Data batal dihapus", "error");
}
}
);
});
public/theme/images/logo-dark.png

8.15 KB | W: | H:

public/theme/images/logo-dark.png

29.7 KB | W: | H:

public/theme/images/logo-dark.png
public/theme/images/logo-dark.png
public/theme/images/logo-dark.png
public/theme/images/logo-dark.png
  • 2-up
  • Swipe
  • Onion skin
public/theme/images/logo-light.png

6.89 KB | W: | H:

public/theme/images/logo-light.png

25.1 KB | W: | H:

public/theme/images/logo-light.png
public/theme/images/logo-light.png
public/theme/images/logo-light.png
public/theme/images/logo-light.png
  • 2-up
  • Swipe
  • Onion skin
@tailwind base;
@tailwind components;
@tailwind utilities;
require('./bootstrap');
import './bootstrap';
import Alpine from 'alpinejs';
window.Alpine = Alpine;
Alpine.start();
# Privacy Policy
Edit this file to define the privacy policy for your application.
# Terms of Service
Edit this file to define the terms of service for your application.
// Body
$body-bg: #f8fafc;
// Typography
$font-family-sans-serif: 'Nunito', sans-serif;
$font-size-base: 0.9rem;
$line-height-base: 1.6;
// Fonts
@import url('https://fonts.googleapis.com/css?family=Nunito');
// Variables
@import 'variables';
// Bootstrap
@import '~bootstrap/scss/bootstrap';
<div>
<!-- Generate API Token -->
<x-jet-form-section submit="createApiToken">
<x-slot name="title">
{{ __('Create API Token') }}
</x-slot>
<x-slot name="description">
{{ __('API tokens allow third-party services to authenticate with our application on your behalf.') }}
</x-slot>
<x-slot name="form">
<!-- Token Name -->
<div class="col-span-6 sm:col-span-4">
<x-jet-label for="name" value="{{ __('Token Name') }}" />
<x-jet-input id="name" type="text" class="mt-1 block w-full" wire:model.defer="createApiTokenForm.name" autofocus />
<x-jet-input-error for="name" class="mt-2" />
</div>
<!-- Token Permissions -->
@if (Laravel\Jetstream\Jetstream::hasPermissions())
<div class="col-span-6">
<x-jet-label for="permissions" value="{{ __('Permissions') }}" />
<div class="mt-2 grid grid-cols-1 md:grid-cols-2 gap-4">
@foreach (Laravel\Jetstream\Jetstream::$permissions as $permission)
<label class="flex items-center">
<x-jet-checkbox wire:model.defer="createApiTokenForm.permissions" :value="$permission"/>
<span class="ml-2 text-sm text-gray-600">{{ $permission }}</span>
</label>
@endforeach
</div>
</div>
@endif
</x-slot>
<x-slot name="actions">
<x-jet-action-message class="mr-3" on="created">
{{ __('Created.') }}
</x-jet-action-message>
<x-jet-button>
{{ __('Create') }}
</x-jet-button>
</x-slot>
</x-jet-form-section>
@if ($this->user->tokens->isNotEmpty())
<x-jet-section-border />
<!-- Manage API Tokens -->
<div class="mt-10 sm:mt-0">
<x-jet-action-section>
<x-slot name="title">
{{ __('Manage API Tokens') }}
</x-slot>
<x-slot name="description">
{{ __('You may delete any of your existing tokens if they are no longer needed.') }}
</x-slot>
<!-- API Token List -->
<x-slot name="content">
<div class="space-y-6">
@foreach ($this->user->tokens->sortBy('name') as $token)
<div class="flex items-center justify-between">
<div>
{{ $token->name }}
</div>
<div class="flex items-center">
@if ($token->last_used_at)
<div class="text-sm text-gray-400">
{{ __('Last used') }} {{ $token->last_used_at->diffForHumans() }}
</div>
@endif
@if (Laravel\Jetstream\Jetstream::hasPermissions())
<button class="cursor-pointer ml-6 text-sm text-gray-400 underline" wire:click="manageApiTokenPermissions({{ $token->id }})">
{{ __('Permissions') }}
</button>
@endif
<button class="cursor-pointer ml-6 text-sm text-red-500" wire:click="confirmApiTokenDeletion({{ $token->id }})">
{{ __('Delete') }}
</button>
</div>
</div>
@endforeach
</div>
</x-slot>
</x-jet-action-section>
</div>
@endif
<!-- Token Value Modal -->
<x-jet-dialog-modal wire:model="displayingToken">
<x-slot name="title">
{{ __('API Token') }}
</x-slot>
<x-slot name="content">
<div>
{{ __('Please copy your new API token. For your security, it won\'t be shown again.') }}
</div>
<x-jet-input x-ref="plaintextToken" type="text" readonly :value="$plainTextToken"
class="mt-4 bg-gray-100 px-4 py-2 rounded font-mono text-sm text-gray-500 w-full"
autofocus autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
@showing-token-modal.window="setTimeout(() => $refs.plaintextToken.select(), 250)"
/>
</x-slot>
<x-slot name="footer">
<x-jet-secondary-button wire:click="$set('displayingToken', false)" wire:loading.attr="disabled">
{{ __('Close') }}
</x-jet-secondary-button>
</x-slot>
</x-jet-dialog-modal>
<!-- API Token Permissions Modal -->
<x-jet-dialog-modal wire:model="managingApiTokenPermissions">
<x-slot name="title">
{{ __('API Token Permissions') }}
</x-slot>
<x-slot name="content">
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
@foreach (Laravel\Jetstream\Jetstream::$permissions as $permission)
<label class="flex items-center">
<x-jet-checkbox wire:model.defer="updateApiTokenForm.permissions" :value="$permission"/>
<span class="ml-2 text-sm text-gray-600">{{ $permission }}</span>
</label>
@endforeach
</div>
</x-slot>
<x-slot name="footer">
<x-jet-secondary-button wire:click="$set('managingApiTokenPermissions', false)" wire:loading.attr="disabled">
{{ __('Cancel') }}
</x-jet-secondary-button>
<x-jet-button class="ml-3" wire:click="updateApiToken" wire:loading.attr="disabled">
{{ __('Save') }}
</x-jet-button>
</x-slot>
</x-jet-dialog-modal>
<!-- Delete Token Confirmation Modal -->
<x-jet-confirmation-modal wire:model="confirmingApiTokenDeletion">
<x-slot name="title">
{{ __('Delete API Token') }}
</x-slot>
<x-slot name="content">
{{ __('Are you sure you would like to delete this API token?') }}
</x-slot>
<x-slot name="footer">
<x-jet-secondary-button wire:click="$toggle('confirmingApiTokenDeletion')" wire:loading.attr="disabled">
{{ __('Cancel') }}
</x-jet-secondary-button>
<x-jet-danger-button class="ml-3" wire:click="deleteApiToken" wire:loading.attr="disabled">
{{ __('Delete') }}
</x-jet-danger-button>
</x-slot>
</x-jet-confirmation-modal>
</div>
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
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