Jun 27, 2016
0
Level 3
Relationship store data
Hi I'm new to Laravel so need little bit help... I have 3 tables with eloquent relationship. Reading data works great but now I'm trying to store new data. In form there are data I want to store into 3 tables. My questions are:
Should I put validation for whole form into PageRequest file? In my form I have inputs for 3 language version and name for input looks like title[en] / title[de] / title[sk]. Whats the best solution to save this inputs with laravel?
Relationship is hasOne and belongsTo...
My store function:
public function store(Requests\PageRequest $request)
{
$input = $request->except('image');
$page = Page::create($input);
Flash::success(trans('page.messageNewPage', ['title' => $page->title[sk]]));
return redirect('admin/page/sections');
}
Please or to participate in this conversation.