trying laravel query functions instead of raw sql