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 = new Profile;
$profile->npsn = $request->npsn;
$profile->ms_tingkat_sekolah_id = $request->tingkat_sekolah;
$profile->status_sekolah = $request->status_sekolah;
$profile->alamat_sekolah = $request->alamat_sekolah;
$profile->ms_provinsi_id = decode_id($request->provinsi);
$profile->ms_kabupaten_id = decode_id($request->kabupaten);
$profile->ms_kecamatan_id = decode_id($request->kecamatan);
$profile->lat = $request->lat;
$profile->long = $request->long;
$profile->ms_sekolah_id = $sekolah->MsSekolahId;
$profile->kontak_person = session('kontak_person');
$profile->telp = session('telp');
$profile->user_id = auth()->user()->id;
$profile->save();
$profile = Profile::updateOrCreate([
'npsn' => $request->npsn,
'user_id' => auth()->user()->id,
],[
'npsn' => $request->npsn,
'ms_tingkat_sekolah_id' => $request->tingkat_sekolah,
'status_sekolah' => $request->status_sekolah,
'alamat_sekolah' => $request->alamat_sekolah,
'ms_provinsi_id' => decode_id($request->provinsi),
'ms_kabupaten_id' => decode_id($request->kabupaten),
'ms_kecamatan_id' => decode_id($request->kecamatan),
'lat' => $request->lat,
'long' => $request->long,
'ms_sekolah_id' => $sekolah->MsSekolahId,
'kontak_person' => session('kontak_person'),
'telp' => session('telp'),
'user_id' => auth()->user()->id,
]);
DB::commit();
return redirect('dashboard');

View File

@ -11,24 +11,7 @@ class ProfileSekolah extends Model
protected $table = 'profile';
protected $primaryKey = 'ProfileId';
protected $fillable = [
'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',
];
protected $guarded = [];
public function tingkat()
{