protected function bulk(Request $request, $action, $transKey, array $input = [])
    {
        $this->validate($request, ['items' => 'required']);

        $items = $request->input('items');
        $request->replace($input);
        $models = collect();

        foreach ($items as $id) {
            $response = $this->{$action}($id, $request);

            if (!$response->isNotFound()) {
                if ($response->isClientError()) {
                    return $response;
                }

                $models->push($response->getOriginalContent());
            }
        }

        return $this->response($models, $this->trans($transKey, $models->count()));
    }
protected function bulk(Request $request, $action, $transKey, array $input = [])
    {
        $this->validate($request, ['items' => 'required']);

        $items = $request->input('items');
        $request->replace($input);
        $models = collect();

        foreach ($items as $id) {
            $response = $this->{$action}($id, $request);

            if (!$response->isNotFound()) {
                if ($response->isClientError()) {
                    return $response;
                }

                $models->push($response->getOriginalContent());
            }
        }

        return $this->response($models, $this->trans($transKey, $models->count()));
    }
protected function bulk ( Request $ request , $ action , $ transKey , array $ input = [ ] ) { $ this -> validate ( $ request , [ 'items' => 'required' ] ) ; $ items = $ request -> input ( 'items' ) ; $ request -> replace ( $ input ) ; $ models = collect ( ) ; foreach ( $ items as $ id ) { $ response = $ this -> { $ action } ( $ id , $ request ) ; if ( ! $ response -> isNotFound ( ) ) { if ( $ response -> isClientError ( ) ) { return $ response ; } $ models -> push ( $ response -> getOriginalContent ( ) ) ; } } return $ this -> response ( $ models , $ this -> trans ( $ transKey , $ models -> count ( ) ) ) ; }
Carry out a bulk action.

@param  Request  $request
@param  string  $action
@param  string  $transKey
@param  array  $input
@return JsonResponse|Response
Carry out a bulk action .