#Error: $store_id is undefined

9 messages · Page 1 of 1 (latest)

delicate shuttle
#

Controller:

public function store(Request $request, $machineSlotId)
    {       
        //$machineSlots = MachineSlot::where('machine_address_id', $machineSlotId)->paginate(5);
        $machineSlots = $this->getMachineSlotData1($machineSlotId);
        $products = $this->getProductsData();
        $store_id = Machine::where([Machine::COLUMN_MACHINE_ADDRESS_ID => $machineSlotId])->first(['store_id'])->store_id;         
        //create new record
        MachineSlot::create($request->all());   
        //display text
        Session::flash('success', "Table has been updated.");
        //display return
        //return view('machine-slots', compact('machineSlotId', 'machineSlots', 'products', 'store_id'));        
        return redirect()->route('machine-slots.index')->with(compact('machineSlotId', 'machineSlots', 'products', 'store_id'));                     
    }

web:

Route::get('/machine-slots', [App\Http\Controllers\UI\MachineSlotController::class, 'index'])->name('machine-slots.index');
somber atlas
#

#general message

#

that's what you are doing, so consider either not flashing the data or retrieving it properly

#

look here to understand how to just pass data instead of flashing it to session

somber atlas
leaden sluice