public function massUpdate(CommentsRequest $request)
    {
        $this->authorize('otherUpdate', $this->model);

        $comments = $this->model->whereIn('id', $request->comments);
        $messages = [];

        switch ($request->mass_action) {
            case 'published':
                if (! $comments->update(['is_approved' => true])) {
                    $messages[] = 'unable to published';
                }
                break;
            case 'unpublished':
                if (! $comments->update(['is_approved' => false])) {
                    $messages[] = 'unable to unpublished';
                }
                break;
            case 'delete':
                if (! $comments->get()->each->delete()) {
                    $messages[] = 'unable to delete';
                }
                break;
        }

        $message = empty($messages) ? 'msg.complete' : 'msg.complete_but_null';

        return $this->makeRedirect(true, 'admin.comments.index', $message);
    }
public function massUpdate(CommentsRequest $request)
    {
        $this->authorize('otherUpdate', $this->model);

        $comments = $this->model->whereIn('id', $request->comments);
        $messages = [];

        switch ($request->mass_action) {
            case 'published':
                if (! $comments->update(['is_approved' => true])) {
                    $messages[] = 'unable to published';
                }
                break;
            case 'unpublished':
                if (! $comments->update(['is_approved' => false])) {
                    $messages[] = 'unable to unpublished';
                }
                break;
            case 'delete':
                if (! $comments->get()->each->delete()) {
                    $messages[] = 'unable to delete';
                }
                break;
        }

        $message = empty($messages) ? 'msg.complete' : 'msg.complete_but_null';

        return $this->makeRedirect(true, 'admin.comments.index', $message);
    }
public function massUpdate ( CommentsRequest $ request ) { $ this -> authorize ( 'otherUpdate' , $ this -> model ) ; $ comments = $ this -> model -> whereIn ( 'id' , $ request -> comments ) ; $ messages = [ ] ; switch ( $ request -> mass_action ) { case 'published' : if ( ! $ comments -> update ( [ 'is_approved' => true ] ) ) { $ messages [ ] = 'unable to published' ; } break ; case 'unpublished' : if ( ! $ comments -> update ( [ 'is_approved' => false ] ) ) { $ messages [ ] = 'unable to unpublished' ; } break ; case 'delete' : if ( ! $ comments -> get ( ) -> each -> delete ( ) ) { $ messages [ ] = 'unable to delete' ; } break ; } $ message = empty ( $ messages ) ? 'msg.complete' : 'msg.complete_but_null' ; return $ this -> makeRedirect ( true , 'admin.comments.index' , $ message ) ; }
Mass updates to Comment.

@param  \BBCMS\Http\Requests\Admin\CommentsRequest  $request
@param  \BBCMS\Models\Comment  $comment
@return \Illuminate\Http\Response
Mass updates to Comment .