skip to Main Content

Dynamic Database Connections in Laravel

As already known we can add more database connection in Laravel by updating app/config/database.php file in the connections array and using Schema::connection('mysql2')->... amd = DB::connection('mysql2')->select(...); to do queries. BUT, what if I want 50 databases or more, I can create…

VIEW QUESTION

Postgresql – How to optimize complex sorting?

I'm building a language learning platform, here are some tables: create table users ( id bigserial primary key, ... ) create table users_languages ( id bigserial primary key, user_id bigint not null constraint users_languages_user_id_foreign references users, level varchar(255) not null,…

VIEW QUESTION

SQL query for woocommerce

I built a woocommerce sql query to list all products with their important values. Here my query: SELECT p.ID, p.post_type as Art, p.post_title AS Produkt, p.post_excerpt AS Beschreibung, t.name AS Produzent, MAX(CASE WHEN pm1.meta_key = 'faktor' then pm1.meta_value ELSE NULL…

VIEW QUESTION

Can't update my inventory table with array laravel

I have an array list of data I want to update to the inventory table. $data['items'] = DB::table('inventory_items')->select('inventory_items.*') ->join('sorder_parts', 'inventory_items.id', 'sorder_parts.inventory_id') ->where('sorder_parts.sorder_id', '=', $id) ->selectraw('inventory_items.quantity - sorder_parts.quantity AS new_quantity') ->get()->toArray(); foreach ($data as $product_item) { $reduce_quantity = InventoryItem::updateOrCreate(['id' => $product_item['items']['id']],…

VIEW QUESTION
Back To Top
Search