src/lib/Http/Controllers/ItemController.php
public function postDeletePhoto(Request $request)
    {
        if (session()->has('photos')) {
            $photos = session('photos');

            foreach ($photos as $index => $photo) {
                if (in_array($request->input('file'), $photo)) {
                    $photo = Photo::find($photo['photo_id']);

                    $photo->delete();

                    unset($photos[$index]);

                    session('photos', $photos);

                    return response('', 200);
                }
            }
        }

        return response('', 400);
    }
public function postDeletePhoto(Request $request)
    {
        if (session()->has('photos')) {
            $photos = session('photos');

            foreach ($photos as $index => $photo) {
                if (in_array($request->input('file'), $photo)) {
                    $photo = Photo::find($photo['photo_id']);

                    $photo->delete();

                    unset($photos[$index]);

                    session('photos', $photos);

                    return response('', 200);
                }
            }
        }

        return response('', 400);
    }
public function postDeletePhoto ( Request $ request ) { if ( session ( ) -> has ( 'photos' ) ) { $ photos = session ( 'photos' ) ; foreach ( $ photos as $ index => $ photo ) { if ( in_array ( $ request -> input ( 'file' ) , $ photo ) ) { $ photo = Photo :: find ( $ photo [ 'photo_id' ] ) ; $ photo -> delete ( ) ; unset ( $ photos [ $ index ] ) ; session ( 'photos' , $ photos ) ; return response ( '' , 200 ) ; } } } return response ( '' , 400 ) ; }
Delete a photo.

@param \Illuminate\Http\Request $request

@return \Illuminate\Http\Response
Delete a photo .