public function store(ProductCreateRequest $request) { $product = $this->product->create($request->all()); $product->productLogs()->create(array('user_id' => 1, 'status_log' => 'test b test', 'body' => 'test test test test test')); if ($product) { flash()->success(trans('product.products'), trans('product.product_create_success')); return redirect('/products/' . $product->id); } }
public function store(ProductCreateRequest $request) { $data = $request->all(); if ($request->file('file') != null) { $data = $this->makePic($request->file('file'), $data); } Product::create($data); flash()->success(trans('product.label.name'), trans('product.message_alert.create_success')); return redirect('/products'); }