app/Http/Controllers/CategoryController.php
//    ------------------------- insert info products in table info product  table using the InfoProduct model
insert info products in table info product  table using the InfoProduct model
insert info products in table info product table using the InfoProduct model
public function Product_Info_add(Request $request)
    {
        $request->validate([
            'addmore.*.title' => 'required',
            'addmore.*.description' => 'required',
        ]);
        foreach ($request->addmore as $key => $value) {
            $translation_table = TranslationLang::all();
            foreach ($translation_table as $language){
                $lang = $language->folder;
                $file = $lang.'.json';
                $destinationPath=storage_path('..\resources\lang\\');
                $path_ru = storage_path('..\resources\lang\\'.$file);
                $lang = json_decode(file_get_contents($path_ru), true);
                $lang[$value['title']] = $value['title'];
                $lang[$value['description']] = $value['description'];
                File::put($destinationPath.$file, json_encode($lang));
            }
            InfoProduct::create([
                        'parent_id' => $value['parent_id'],
                        'title' => $value['title'],
                        'description' => $value['description'],
        ]);
        }
        return back()->with('success', 'Record Created Successfully.');
    }
public function Product_Info_add ( Request $ request ) { $ request -> validate ( [ 'addmore.*.title' => 'required' , 'addmore.*.description' => 'required' , ] ) ; foreach ( $ request -> addmore as $ key => $ value ) { $ translation_table = TranslationLang :: all ( ) ; foreach ( $ translation_table as $ language ) { $ lang = $ language -> folder ; $ file = $ lang . '.json' ; $ destinationPath = storage_path ( '..\resources\lang\\' ) ; $ path_ru = storage_path ( '..\resources\lang\\' . $ file ) ; $ lang = json_decode ( file_get_contents ( $ path_ru ) , true ) ; $ lang [ $ value [ 'title' ] ] = $ value [ 'title' ] ; $ lang [ $ value [ 'description' ] ] = $ value [ 'description' ] ; File :: put ( $ destinationPath . $ file , json_encode ( $ lang ) ) ; } InfoProduct :: create ( [ 'parent_id' => $ value [ 'parent_id' ] , 'title' => $ value [ 'title' ] , 'description' => $ value [ 'description' ] , ] ) ; } return back ( ) -> with ( 'success' , 'Record Created Successfully.' ) ; }
insert info products in table info product  table using the InfoProduct model
insert info products in table info product table using the InfoProduct model