Error Undefined offset: 5 in multiple insert Laravel 6

I want to make a restaurant ordering system where the waiter can put more than 1 food menu, I tried to make multiple inserts, but there was an error like this Undefined offset: 5 My Controller looks like this: foreach ($request->menu_id as $item) { $data_item = array(‘menu_id’ => $request->menu_id[$item], ‘order_id’=>$request->order_id[$item], ‘qty’=>$request->qty[$item], ‘subtotal’=>0 ); Order_detail::insert($data_item); My…

How to fix Laravel 6 Undefined variable

I need some help to fix the error from my code. I am trying to Display data on Laravel view page. But while I am trying to use #foreach then I am getting error on the View page. I’m getting this error: Undefined variable: employee (View: I:\server\htdocs\laravel-projects\ocofamerica.com\resources\views\adminboard\employee\application.blade.php) I want to display the database info. Here’s…

laravel where condition with the % operator

today i’m trying to get modulus operator in where laravel clause but i can’t get it work and after make some google researches and read the documentation i post this may be some one can help me to get a solution Produit::has(‘caracteristique.image’, ‘=’, 2) //->where(‘(caracteristique.image.caracteristique_id)’, ‘=’, 2) ->has(‘caracteristique.stock’) ->where(‘market_id’, Auth()->user()->market->id) ->where(DB::raw(‘count(`produits`.`caracteristiques`.`images`.`caracteristique_id`)’), ‘%2’, [2]) ->get(); i…

Laravel 5.8 request data is empty

router.php Route::get(‘/p00001/edit/{center}/{id}’, ‘Dashboard\Programs\P00001Controller@edit’); Route::put(‘/p00001/update/{center}/{id}’, ‘Dashboard\Programs\P00001Controller@update’); form.blade.php <!DOCTYPE html> <html dir=”ltr” lang=”zh-TW”> <body> <form id=”mainform” action=”/dashboard/programs/p00001/update/JPN/3121-111907230007″ method=”post” class=”form-horizontal”> <input type=”text” value=’1234′ id=”inpTest” name=”inpTest”> <input type=”submit” name=”inpSubmit”> </form> </body> </html> P00001Controller.php public function __construct(Request $request, P00001Service $P00001Service ) { $this->request = $request; } public function update($center, $id) { $data = $this->request->all(); echo “<pre>”, print_r($_POST, 1), “</pre>”; echo…