app/Http/Controllers/Admin/todoController.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(ToDoValidator $request, $id)
    {
        $todo = ToDo::findorfail($id);
        if ($request->hasFile('fileUpload')) {
            $image = $request->file('fileUpload');
            $fileUploads = "photo-" . time() . '.' . $image->getClientOriginalExtension();
            $image->move('images/taskfile/', $fileUploads);
            $todo->fileUpload=$fileUploads;
            }
        $todo->title= $request->input('title');
        $todo->description=$request->input('description');
        $todo->assignedDate=$request->input('assignedDate');
        $todo->assignedTo=$request->input('assignedTo');
        $todo->deadline=$request->input('deadline');
        $todo->task_priority=$request->input('task_priority');
        $todo->remarks=$request->input('remarks');
        $todo->assignedBy=$request->input('assignedBy');
        $todo->Reassignedby=$request->input('Reassignedby');
        $todo->Reassignedto=$request->input('Reassignedto');
        $todo->Reassigneddate=$request->input('Reassigneddate');
        $todo->Redeadline=$request->input('Redeadline');
        $todo->reason=$request->input('reason');
        $todo->status=$request->input('status');
        $todo->remarks=$request->input('remarks');
        $todo->user_id=$request->input('user_id');
        $todo->Reuser_id=$request->input('Reuser_id');
       $update= $todo->save();
        if ($update) {
            if (Auth::user()->roles->name == 'admin') {
                return redirect()->route('assignTask')->with('success', 'Selected Task updated successfully');
            } else {
                return redirect()->route('todo.index')->with('success', 'Selected Task updated successfully');
            }
        } else {
            return redirect()->back()->with('error', 'Sorry the changes couldn\'t be made');
        }
        return redirect()->route('todo.index')->with('success', 'ToDo Updated Successfully');
    }
public function update ( ToDoValidator $ request , $ id ) { $ todo = ToDo :: findorfail ( $ id ) ; if ( $ request -> hasFile ( 'fileUpload' ) ) { $ image = $ request -> file ( 'fileUpload' ) ; $ fileUploads = " photo- " . time ( ) . '.' . $ image -> getClientOriginalExtension ( ) ; $ image -> move ( 'images/taskfile/' , $ fileUploads ) ; $ todo -> fileUpload = $ fileUploads ; } $ todo -> title = $ request -> input ( 'title' ) ; $ todo -> description = $ request -> input ( 'description' ) ; $ todo -> assignedDate = $ request -> input ( 'assignedDate' ) ; $ todo -> assignedTo = $ request -> input ( 'assignedTo' ) ; $ todo -> deadline = $ request -> input ( 'deadline' ) ; $ todo -> task_priority = $ request -> input ( 'task_priority' ) ; $ todo -> remarks = $ request -> input ( 'remarks' ) ; $ todo -> assignedBy = $ request -> input ( 'assignedBy' ) ; $ todo -> Reassignedby = $ request -> input ( 'Reassignedby' ) ; $ todo -> Reassignedto = $ request -> input ( 'Reassignedto' ) ; $ todo -> Reassigneddate = $ request -> input ( 'Reassigneddate' ) ; $ todo -> Redeadline = $ request -> input ( 'Redeadline' ) ; $ todo -> reason = $ request -> input ( 'reason' ) ; $ todo -> status = $ request -> input ( 'status' ) ; $ todo -> remarks = $ request -> input ( 'remarks' ) ; $ todo -> user_id = $ request -> input ( 'user_id' ) ; $ todo -> Reuser_id = $ request -> input ( 'Reuser_id' ) ; $ update = $ todo -> save ( ) ; if ( $ update ) { if ( Auth :: user ( ) -> roles -> name == 'admin' ) { return redirect ( ) -> route ( 'assignTask' ) -> with ( 'success' , 'Selected Task updated successfully' ) ; } else { return redirect ( ) -> route ( 'todo.index' ) -> with ( 'success' , 'Selected Task updated successfully' ) ; } } else { return redirect ( ) -> back ( ) -> with ( 'error' , 'Sorry the changes couldn\'t be made' ) ; } return redirect ( ) -> route ( 'todo.index' ) -> with ( 'success' , 'ToDo Updated Successfully' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .