コード例 #1
0
ファイル: Whales.php プロジェクト: KmtvB/LaravelTestWeb15
 /**
  * Store new model and redirect
  *
  * @param WhaleRequest $request data from form
  *
  * @return main page
  *
  */
 public function store(WhaleRequest $request)
 {
     $whale = Whale::create($request->except('food_list'));
     $foodsId = $request->input('food_list', []);
     $whale->foods()->attach($foodsId);
     Session::flash('flash_message', 'New whale has been added!');
     return redirect('whale');
 }
コード例 #2
0
 /**
  * Store new model and redirect
  *
  * @param WhaleRequest $request data from form
  *
  * @return main page
  *
  */
 public function store(WhaleRequest $request)
 {
     Whale::create($request->all());
     \Session::flash('flash_message', 'New whale has been added!');
     return redirect('whale');
 }