app/Http/Controllers/WebhookController.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, $id)
    {
        $newtodo=Todo::find($id);
        $newtodo->user_id=$request->user_id;
        $newtodo->todo_name=$request->todo_name;
        $newtodo->description=$request->description;
        $newtodo->estimated_delivery_time=$request->estimated_delivery_time;
        $newtodo->status=$request->status;
        $images=[];
        if ($request->hasFile('photos')) {
            foreach ($request->photos as $key => $photo) {
                $path = $photo->store('event_images', 'public');
                $image_url= url(Storage::url($path));
                array_push($images,$image_url);
            }
        }
        if(sizeof($images)>1){
            $newtodo->attachments=json_encode($images);
        }
        $newtodo->save();
        return json_encode(['code'=>200,'responce'=>'Details updated successfully']);
    }
public function update ( Request $ request , $ id ) { $ newtodo = Todo :: find ( $ id ) ; $ newtodo -> user_id = $ request -> user_id ; $ newtodo -> todo_name = $ request -> todo_name ; $ newtodo -> description = $ request -> description ; $ newtodo -> estimated_delivery_time = $ request -> estimated_delivery_time ; $ newtodo -> status = $ request -> status ; $ images = [ ] ; if ( $ request -> hasFile ( 'photos' ) ) { foreach ( $ request -> photos as $ key => $ photo ) { $ path = $ photo -> store ( 'event_images' , 'public' ) ; $ image_url = url ( Storage :: url ( $ path ) ) ; array_push ( $ images , $ image_url ) ; } } if ( sizeof ( $ images ) > 1 ) { $ newtodo -> attachments = json_encode ( $ images ) ; } $ newtodo -> save ( ) ; return json_encode ( [ 'code' => 200 , 'responce' => 'Details updated successfully' ] ) ; }
Update the specified resource in storage.
Update the specified resource in storage .