app/Api/V1/Controllers/DocumentController.php
/**
     * batch delete documents
     *
     * @param Request $request
     * @return Response
     * @throws \Illuminate\Validation\ValidationException
     */
batch delete documents
@param Request $request
@return Response
@throws \Illuminate\Validation\ValidationException
batch delete documents @param Request $request @return Response @throws \ Illuminate \ Validation \ ValidationException
public function batchDestroy(Request $request)
    {
        $rules = [
            'paths' => 'required|array',
            'paths.*' => 'required|string'
        ];
        $this->validate($request, $rules);
        $paths = $request->paths ? $request->paths : [];
        $documents = Document::whereIn('path', $paths)->get();
        if (!$documents->count()) {
            throw new DeleteResourceFailedException('documents not found');
        }
        if (Document::deleteDocument($documents)) {
            return new Response(['status' => 'documents deleted'], 201);
        }
        throw new DeleteResourceFailedException('documents delete request failed');
    }
public function batchDestroy ( Request $ request ) { $ rules = [ 'paths' => 'required|array' , 'paths.*' => 'required|string' ] ; $ this -> validate ( $ request , $ rules ) ; $ paths = $ request -> paths ? $ request -> paths : [ ] ; $ documents = Document :: whereIn ( 'path' , $ paths ) -> get ( ) ; if ( ! $ documents -> count ( ) ) { throw new DeleteResourceFailedException ( 'documents not found' ) ; } if ( Document :: deleteDocument ( $ documents ) ) { return new Response ( [ 'status' => 'documents deleted' ] , 201 ) ; } throw new DeleteResourceFailedException ( 'documents delete request failed' ) ; }
batch delete documents
 @param Request $request
 @return Response
 @throws \Illuminate\Validation\ValidationException
batch delete documents @param Request $request @return Response @throws \ Illuminate \ Validation \ ValidationException