app/Http/Controllers/CourseController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, Course $course)
    {
        $request->validate([
            'course_code'   => 'required',
            'name'          => 'required', 
            'level_id'      => 'required',
            'lecturer_id'   => 'required',
        ]);
       $course->update([
            'course_code'   => strtoupper($request->course_code),
            'level_id'      => $request->level_id,
            'name'          => ucwords($request->name),
            'lecturer_id'   => $request->lecturer_id
        ]);
        return redirect()->back()->with('success', 'Course has been updated successfully');
    }
public function update ( Request $ request , Course $ course ) { $ request -> validate ( [ 'course_code' => 'required' , 'name' => 'required' , 'level_id' => 'required' , 'lecturer_id' => 'required' , ] ) ; $ course -> update ( [ 'course_code' => strtoupper ( $ request -> course_code ) , 'level_id' => $ request -> level_id , 'name' => ucwords ( $ request -> name ) , 'lecturer_id' => $ request -> lecturer_id ] ) ; return redirect ( ) -> back ( ) -> with ( 'success' , 'Course has been updated successfully' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .