main
Ilham Wara Nugroho 2026-02-09 14:02:36 +07:00
parent 6ca0ded390
commit bb749e0cc6
2 changed files with 4 additions and 5 deletions

View File

@ -137,7 +137,7 @@ class ProfileController extends Controller
'password.regex' => 'Format Kata Sandi harus mengandung minimal Huruf Besar, Huruf Kecil, Angka, Spesial Karakter', 'password.regex' => 'Format Kata Sandi harus mengandung minimal Huruf Besar, Huruf Kecil, Angka, Spesial Karakter',
])->validate(); ])->validate();
$profile = Profile::where('npsn',auth()->user()->username)->first(); $profile = Profile::where('npsn',auth()->user()->profile->npsn)->first();
$profile->alamat_sekolah = $request->alamat_sekolah; $profile->alamat_sekolah = $request->alamat_sekolah;
$profile->kontak_person = $request->kontak_person; $profile->kontak_person = $request->kontak_person;
$profile->telp = $request->telp; $profile->telp = $request->telp;

View File

@ -7,7 +7,6 @@ use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Auth; use Auth;
use App\Models\User; use App\Models\User;
use App\Models\Master\Sekolah;
class Profile class Profile
{ {
@ -18,9 +17,9 @@ class Profile
*/ */
public function handle(Request $request, Closure $next): Response public function handle(Request $request, Closure $next): Response
{ {
$user = Sekolah::where('npsn',auth()->user()->username)->first(); $user = User::with(['profile'])->where('id',auth()->user()->id)->first();
if(!@$user && (auth()->user()->ms_group_id == 2)){ if(!@$user->profile && ($user->ms_group_id == 2)){
return redirect('profile-sekolah/lengkapi/'.encode_id(auth()->user()->username)); return redirect('profile-sekolah/lengkapi/'.encode_id($user->username));
} }
return $next($request); return $next($request);
} }