/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $model = \App\Models\Offer::create(['title' => $request->get('title'), 'user_id' => $this->user->id]); $model->catalogs()->sync($request->get('catalogs', [])); return redirect('/admin/offer'); }