app/Http/Controllers/ClassesController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Request $request)
    {
        $request->validate([
            'class_name' => 'required',
            'number_of_students' => 'required',
        ]);
        Classes::create($request->all());
        return redirect()->route('class.index')
                        ->with('success','User created successfully.');
    }
public function store ( Request $ request ) { $ request -> validate ( [ 'class_name' => 'required' , 'number_of_students' => 'required' , ] ) ; Classes :: create ( $ request -> all ( ) ) ; return redirect ( ) -> route ( 'class.index' ) -> with ( 'success' , 'User created successfully.' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .