Closed JoshKoberstein closed 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.
Good idea, thanks!
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.