main
Ilham Wara Nugroho 2026-02-09 14:42:21 +07:00
parent ec165f2ecf
commit 00dd924f49
2 changed files with 19 additions and 33 deletions

View File

@ -74,21 +74,24 @@ class ProfileController extends Controller
//profile //profile
$profile = new Profile; $profile = Profile::updateOrCreate([
$profile->npsn = $request->npsn; 'npsn' => $request->npsn,
$profile->ms_tingkat_sekolah_id = $request->tingkat_sekolah; 'user_id' => auth()->user()->id,
$profile->status_sekolah = $request->status_sekolah; ],[
$profile->alamat_sekolah = $request->alamat_sekolah; 'npsn' => $request->npsn,
$profile->ms_provinsi_id = decode_id($request->provinsi); 'ms_tingkat_sekolah_id' => $request->tingkat_sekolah,
$profile->ms_kabupaten_id = decode_id($request->kabupaten); 'status_sekolah' => $request->status_sekolah,
$profile->ms_kecamatan_id = decode_id($request->kecamatan); 'alamat_sekolah' => $request->alamat_sekolah,
$profile->lat = $request->lat; 'ms_provinsi_id' => decode_id($request->provinsi),
$profile->long = $request->long; 'ms_kabupaten_id' => decode_id($request->kabupaten),
$profile->ms_sekolah_id = $sekolah->MsSekolahId; 'ms_kecamatan_id' => decode_id($request->kecamatan),
$profile->kontak_person = session('kontak_person'); 'lat' => $request->lat,
$profile->telp = session('telp'); 'long' => $request->long,
$profile->user_id = auth()->user()->id; 'ms_sekolah_id' => $sekolah->MsSekolahId,
$profile->save(); 'kontak_person' => session('kontak_person'),
'telp' => session('telp'),
'user_id' => auth()->user()->id,
]);
DB::commit(); DB::commit();
return redirect('dashboard'); return redirect('dashboard');

View File

@ -11,24 +11,7 @@ class ProfileSekolah extends Model
protected $table = 'profile'; protected $table = 'profile';
protected $primaryKey = 'ProfileId'; protected $primaryKey = 'ProfileId';
protected $fillable = [ protected $guarded = [];
'user_id',
'npsn',
'ms_provinsi_id',
'ms_kabupaten_id',
'ms_kecamatan_id',
'ms_sekolah_id',
'ms_tingkat_sekolah_id',
'status_sekolah',
'alamat_sekolah',
'kontak_person',
'telp',
'data_jumlah',
'penghematan_air',
'penghematan_listrik',
'lat',
'long',
];
public function tingkat() public function tingkat()
{ {