app/Http/Controllers/LevelController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\Models\Level  $level
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, Level $level)
    {
        $request->validate([
            'name'              => 'required',
            'max_courses'       => 'required',
        ]);
        $level_data = [
            'name'                      => ucwords($request->name),
            'max_number_of_courses'     => $request->max_courses,
        ];
        $level->update($level_data);
        return redirect()->back()->with('success', 'Level has been updated');
    }
public function update ( Request $ request , Level $ level ) { $ request -> validate ( [ 'name' => 'required' , 'max_courses' => 'required' , ] ) ; $ level_data = [ 'name' => ucwords ( $ request -> name ) , 'max_number_of_courses' => $ request -> max_courses , ] ; $ level -> update ( $ level_data ) ; return redirect ( ) -> back ( ) -> with ( 'success' , 'Level has been updated' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .