app/Http/Controllers/ProductController1.php
/**
     * Remove the specified resource from storage.
     *
     * @param  \App\Models\Product  $product
     * @return \Illuminate\Http\Response
     */
Remove the specified resource from storage.
Remove the specified resource from storage .
public function destroy(Request $request)
    {
        $validator = Validator::make($request->all(), [
            'id' => 'required',
        ]);
        if($validator->fails()){
            return $this->sendError('Error validation', $validator->errors());       
        }
        $delete =  Product::find($request->id);
        $delete->delete();
        return $this->sendResponse($delete,'Delete Product Successfully');
    }
public function destroy ( Request $ request ) { $ validator = Validator :: make ( $ request -> all ( ) , [ 'id' => 'required' , ] ) ; if ( $ validator -> fails ( ) ) { return $ this -> sendError ( 'Error validation' , $ validator -> errors ( ) ) ; } $ delete = Product :: find ( $ request -> id ) ; $ delete -> delete ( ) ; return $ this -> sendResponse ( $ delete , 'Delete Product Successfully' ) ; }
Remove the specified resource from storage.
Remove the specified resource from storage .