Ejemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $validasi = Validator::make($request->all(), Soal::$rules, Soal::$pesan);
     if ($validasi->fails()) {
         return Redirect::back()->withInput()->withErrors($validasi);
     } else {
         $soal = new Soal();
         $soal->kd_mapel = $request->input('mapel');
         $soal->kode_jurusan = $request->input('jurusan');
         $soal->waktu_ujian = $request->input('waktu');
         $soal->save();
         Session::flash('pesan', "Data Berhasil disimpan");
         return Redirect::to('admin/soal/' . $soal->id);
     }
 }
Ejemplo n.º 2
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $validasi = Validator::make($request->all(), Guru::$rules, Guru::$pesan);
     if ($validasi->fails()) {
         return Redirect::back()->withInput()->withErrors($validasi);
     } else {
         $guru = new Guru();
         $guru->nip = $request->input('nip');
         $guru->nama = $request->input('nama');
         $guru->password = Hash::make($request->input('password'));
         $guru->kd_mapel = $request->input('mapel');
         $simpan = $guru->save();
         if ($simpan) {
             $soal = new Soal();
             $soal->kd_mapel = $request->input('mapel');
             $soal->kode_jurusan = $request->input('jurusan');
             $soal->author = $request->input('nip');
             $soal->save();
         }
         Session::flash('pesan', "Data Berhasil disimpan");
         return Redirect::to('admin/guru');
     }
 }