public function postSave(Request $request) { $json = $request->get('json'); $page_id = $request->get('page_id'); $page = Page::whereId($page_id)->first(); echo '<pre>'; DB::beginTransaction(); //$page->widgets()->delete(); foreach ($json as &$widget) { //$widget = new Widget($widget); $widget = WidgetHelper::get($widget, $page_id); $page->widgets()->save($widget); } DB::commit(); //$page = DB::table('pages') // ->leftJoin('pages_widget', 'pages_widget.page_id', '=', 'pages.id') // ->where('pages.id', $page_id) // ->first(); //DB::beginTransaction(); //$job_worker->status = 'withdrawn'; //$job_worker->save(); //DB::commit(); }
} .widget.height3 { height: 150px; } .widget.height4 { height: 200px; } .widget.height5 { height: 250px; } .widget.height6 { height: 250px; } .widget.height6 { height: 300px; } </style> </head> <body> <div class="container bs-docs-grid"> <?php \App\Helpers\WidgetHelper::getHtmlStructure($page->widgets->toArray()); ?> </div> <!-- Scripts --> {{ Asset::js() }} </body> </html>
public function postSave(Request $request) { $json = $request->get('json'); $page_id = $request->get('page_id'); $page = Page::whereId($page_id)->first(); DB::beginTransaction(); foreach ($json as &$widget) { //$widget = new Widget($widget); $widget = WidgetHelper::get($widget, $page_id); $page->widgets()->save($widget); } DB::commit(); }