app/Http/Controllers/dashboard/teachers/TasksController.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, $subject_id, $task_id)
    {
        $request->validate([
            "name" => ["required"],
            "description" => ['required'],
            "deadline" => ['required', 'date']
        ]);
        $response = Tasks::query()->where('tasks.subject_id', $subject_id)->where('tasks.id', $task_id)->update([
            "task_name" => $request->post('name'),
            "description" => $request->post('description'),
            "deadline" => $request->post('deadline'),
        ]);
        if (!$response) return back()->with('error', 'try again');
        return redirect(route('teachers-tasks.show', ["subject" => $subject_id]))->with('success', 'tasks was update');
    }
public function update ( Request $ request , $ subject_id , $ task_id ) { $ request -> validate ( [ " name " => [ " required " ] , " description " => [ 'required' ] , " deadline " => [ 'required' , 'date' ] ] ) ; $ response = Tasks :: query ( ) -> where ( 'tasks.subject_id' , $ subject_id ) -> where ( 'tasks.id' , $ task_id ) -> update ( [ " task_name " => $ request -> post ( 'name' ) , " description " => $ request -> post ( 'description' ) , " deadline " => $ request -> post ( 'deadline' ) , ] ) ; if ( ! $ response ) return back ( ) -> with ( 'error' , 'try again' ) ; return redirect ( route ( 'teachers-tasks.show' , [ " subject " => $ subject_id ] ) ) -> with ( 'success' , 'tasks was update' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .