/** * Store a newly created resource in storage. * * @return Response */ public function store(HTMLControlRequest $request) { $HTMLControl = HTMLControl::create($request->all()); //set more info before save data $this->setDefaultInfoBeforeSave($HTMLControl, true); $blnHTMLControl = $HTMLControl->save(); $blnHTMLControlI10n = false; if ($blnHTMLControl) { $HTMLControlI10N = HTMLControl_I10N::create($request->all()); $HTMLControlI10N->i18n_id = $HTMLControl->id; //set more info before save data $this->setDefaultInfoBeforeSave($HTMLControlI10N, true); $blnHTMLControlI10n = $HTMLControlI10N->save(); } //result if ($blnHTMLControl && $blnHTMLControlI10n) { return Redirect::route('admin.HTMLControl.index')->with('message', new MessageBag(['save_complete'])); } else { return Redirect::route('admin.HTMLControl.create', $HTMLControl)->with('message', new MessageBag(['save_error'])); } }