2

I override the Laravel controller but now i don't what's the problem is coz it show me that (Field 'lab_price' doesn't have a default value) I used the merge method when I debugged its good and has a value.

$val = $this->validateBread($request->all(), $dataType->addRows)->validate();

        $l_price = DB::table('labs')
            ->where('id', $request->lab_id)
            ->value('price');
        $request->merge(['lab_price' => $l_price])
        ->all();
        

        $data = $this->insertUpdateData($request, $slug, $dataType->addRows, new $dataType->model_name());

Actually i have lab_price column in child table and i want to get the (price) from the parent table and store in the child table whenever the lab_name is selected from the fronted.

Also if this method doesn't possible here, then is it possible through laravel observer? I also go through it but i didn't find join in observer??

Mrkhan
  • 65
  • 7

0 Answers0