app/Http/Controllers/BusinessesController.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)
    {
        $updated = Business::find($id);
        if($updated){
            if ($request) {
                $updated->Company = $request->Company;
                $updated->location = $request->location;
                $updated->Manager = $request->Manager;
                $updated->Phone = $request->Phone;
                $updated->fax = $request->fax;
                $updated->website = $request->website;
                $updated->user_id = $request->user_id;
                $updated-> save();
                return $updated;
            }else {
            return response()->json([
                "message" => "the service to udate is not found"
            ]);
        }
        }else {
            return response()->json([
                "message" => "the service to udate is not found"
            ]);
        }
    }
public function update ( Request $ request , $ id ) { $ updated = Business :: find ( $ id ) ; if ( $ updated ) { if ( $ request ) { $ updated -> Company = $ request -> Company ; $ updated -> location = $ request -> location ; $ updated -> Manager = $ request -> Manager ; $ updated -> Phone = $ request -> Phone ; $ updated -> fax = $ request -> fax ; $ updated -> website = $ request -> website ; $ updated -> user_id = $ request -> user_id ; $ updated -> save ( ) ; return $ updated ; } else { return response ( ) -> json ( [ " message " => " the service to udate is not found " ] ) ; } } else { return response ( ) -> json ( [ " message " => " the service to udate is not found " ] ) ; } }
Update the specified resource in storage.
Update the specified resource in storage .
//update a business wth the id = $id //checking if that business exist in our database # update the resorce