Hello, I am new to eloquent and laravel, I have the following query, which runs perfectly from phpmyadmin:
SELECT * FROM vips_categories JOIN vips_products JOIN vip_archivos WHERE vips_categories.parent_id = 1 AND vips_categories.parent_id = vips_products.id AND vip_archivos.id = vips_products.img
I wanted to do the following:
$query = DB::table('vips_products AS Producto)
->join('vips_categories as Categoria.','Categoria.parent_id','=',$categoria)
->join('vips_categories as Categoria','Categoria.parent_id','=','Producto.id')
->join('vip_archivos', 'vip_archivos.id', '=', 'Producto.img')
->select('*');
But apparently it is incorrect, if someone could help me translate it I would be very grateful
First of all as I see, there is a syntax error in DB::table('vips_products AS Product), that string needs to be closed. Second, you are using Query Builder but not Eloquent. If what you need is to get that query in the Query Builder it would be something like this: