<h4>EXISTING TEXT</h4>
<table class="table table-hover table-striped">
    <?php foreach($texts->all() as $text): ?>
        <tr id="text<?php echo e($text->id); ?>">
            <td><?php echo e($text->mainText); ?></td>
            <?php /*<td><a href=""><span class="fa fa-edit fa-2x"></span></a></td>*/ ?>
            <td><a href="#" data-id="<?php echo e($text->id); ?>" class="deleteRotate"><span class="fa fa-trash-o fa-2x"></span></a></td>
        </tr>
    <?php endforeach; ?>
</table>

<script>
    $(document).ready(function () {
        $('.deleteRotate').click(function(e){
            e.preventDefault();
            var id = $(this).attr('data-id');
            $.ajax({
                type: "GET",
                url: "trashText/"+id,
                success: function (data) {
                    $('#text'+data).hide();
                },
                failure: function (data) {
                    console.log(data);
                }
            });
        });
    });
</script>