Advertisement
Guest User

Controller

a guest
Jul 7th, 2020
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.70 KB | None | 0 0
  1.     public function create()
  2.     {
  3.         $chapters = Chapter::where([["subject_id", "=", 1], ["grade_id", "=", 1]])->get();
  4.         $data = array(
  5.             'chapters'  => $chapters,
  6.         );
  7.  
  8.         return view('kelas7.soal.create', $data);
  9.     }
  10.  
  11.     public function store(Request $request)
  12.     {
  13.        
  14.  
  15.         $new_test = new DailyTest;
  16.  
  17.         $new_test->chapter_id = $request->get('chapter_id');
  18.         $new_test->question = $request->get('question');
  19.         $new_test->answer = $request->get('answer');
  20.         $new_test->keyword = $request->get('keyword');
  21.  
  22.         $new_test->save();
  23.  
  24.         return redirect()->route('soal7.index')
  25.             ->with('success',' created successfully.');
  26.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement