Aug 7, 2024
web.php
untuk menambahkan routing baru.Route::get('student/create', [StudentController::class, 'create']);
student/create
create
students.create
.create.blade.php
di dalam folder students
.name
address
phone_number
class
btn btn-primary
method='post'
{{ csrf_field() }}
store
di dalam StudentController
:
public function store(Request $request) {
$student = new Student();
$student->name = $request->name;
$student->address = $request->address;
$student->phone_number = $request->phone_number;
$student->class = $request->class;
$student->save();
return redirect()->back();
}