skip to Main Content

Rollback migration in laravel

I want to write down() function in migration and after run rollback command I'm getting error. Migration that i want to rollback looks like this: public function up(): void { Schema::table('posts', function (Blueprint $table) { $table->foreignId('competition_id')->after('content_id')->nullable()->constrained('competitions'); $table->unique(['account_id', 'competition_id']); }); }…

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