Advertisement
hamjoricantiq

Untitled

Apr 4th, 2020
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.53 KB | None | 0 0
  1. public function store(Request $request) {
  2.         $rule = [
  3.             'nama_kelas' => 'required',
  4.             'jurusan' => 'required',
  5.             'lokasi_ruangan' => 'required|min:2',
  6.             'nama_walikelas' => 'required',
  7.         ];
  8.         $this->validate($request, $rule);
  9.  
  10.         $input = $request->all();
  11.         unset($input['_token']);
  12.         $status = \DB::table('t_kelas')->insert($input);
  13.  
  14.         if ($status) {
  15.             return redirect('/tugas')->with('success', 'Data berhasil ditambahkan');
  16.         } else {
  17.             return redirect('/kelas/create')->with('error', 'Data gagal ditambahkan');
  18.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement