I have query on laravel
$types=Types::selectRaw('COUNT(property_types.id) as total, property_types.types, property_types.id')
->join('properties', 'property_types.id', '=',
'properties.property_type')
->where('property_purpose', '"Sale"')
->groupBy('property_types.id','property_types.id','property_types.types')
->get();
And I dont have any result
Collection {#383 ▼
#items: []
I change ->get() by ->toSql(); And I have laravel query
select COUNT(property_types.id) as total, property_types.types, property_types.id from property_types
inner join properties
on property_types
.id
= properties
.property_type
where property_purpose
= ? group by property_types
.id
, property_types
.id
, property_types
.types
Change ? by variable "Sale" copy and paste on PhpMyadmin and I got te result that I want
I dont know what wrong on Laravel Eloquent!
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire