Porting some old helpers over from the laravel implementation