/**
  * Store a newly created resource in storage.
  *
  * @param  Request $request
  * @return Response
  */
 public function store(ProductAddFormRequest $request)
 {
     if ($request->get('pcategories')) {
         $category = products::create(['name' => $request->get('name'), 'is_active' => $request->get('is_active'), 'description' => $request->get('description'), 'price' => $request->get('price')]);
         if (!empty($request->get('pcategories'))) {
             $category->category()->sync($request->get('pcategories'));
         }
         return view('admin/image/create', compact('category'));
     } else {
         return redirect()->route('gift/list')->with('message', Lang::get('response.CUSTOM_MESSAGE_ALERT', ['message' => 'The product could not added']));
     }
 }
 public function StoreAction(ProductAddFormRequest $request)
 {
     $p = [$request->get('pcategories'), $request->get('category')];
     $value = array_collapse($p);
     if (!empty($request->get('pcategories')) & !empty($request->get('category'))) {
         $category = products::create(['name' => $request->get('name'), 'is_active' => $request->get('is_active'), 'description' => $request->get('description'), 'starting_pound' => $request->get('starting_pound'), 'price' => $request->get('price'), 'ending_pound' => $request->get('ending_pound')]);
         $category->category()->sync($value);
         return view('admin/image/create', compact('category'));
     } else {
         return redirect()->back()->with('message', Lang::get('response.CUSTOM_MESSAGE_ALERT', ['message' => 'Please choose Parent category']));
     }
 }