I wrote the following eloquent query for a table in my application and now the application won't stop loading. what i need is to understand what is wrong with it and how to fix it
$customer_purchased_1_time=DB::table("data as t1")->select('vin','last_service')
->where('type',1)->distinct('vin')
->whereRaw("(select count(*) from data where t1.vin=data.vin and data.type=1)=1")
->count();
It is the only code in my controller method along with the return statement. the incrementing of x was for debugging