bgultekin / laravel4-datatables-package

Server-side handler of DataTables Jquery Plugin for Laravel 4
267 stars 108 forks source link

Allowing trailing whitespace #127

Closed JoshKoberstein closed 10 years ago

JoshKoberstein commented 10 years ago
    $distributors = DB::table('distributors')
        ->select(
            'distributors.id',
            'distributors.company_name',
            DB::raw('
                CONCAT_WS(\', \',
                    IF(LENGTH(`address_1`), `address_1`, NULL),
                    IF(LENGTH(`address_2`), `address_2`, NULL),
                    IF(LENGTH(`city`), `city`, NULL),
                    IF(LENGTH(`state`), `state`, NULL),
                    IF(LENGTH(`zip`), `zip`, NULL)
                ) AS address
            '),
            DB::raw('
                (
                    SELECT COUNT(*)
                    FROM redemptions
                    WHERE redemptions.distributor_id = distributors.id
                ) AS redemption_count
            ')
        );

I like to format my DB::raws with space at the end. It would be great if the clean_columns regex accommodated this as per my commit. Thanks.

ktunkiewicz commented 10 years ago

Good idea, thanks!