app/Http/Controllers/ProductController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Requests\StoreProductRequest $request)
    {
        $product = new Product();
        $product->name = $request->input('name');
        $product->description = $request->input('description');
        $product->price = $request->input('price');
        $request->input('sale_price') == "" ? $product->sale_price = null : $product->sale_price = $request->input('sale_price');
        $product->image_path = ImageManager::saveImage($request->file('product_image'));
        $product->quantity = $request->input('quantity') == "" ? $product->quantity = 0 : $product->quantity = $request->input('quantity');
        $product->save();
        return Redirect::to('/admin/product');
    }
public function store ( Requests \ StoreProductRequest $ request ) { $ product = new Product ( ) ; $ product -> name = $ request -> input ( 'name' ) ; $ product -> description = $ request -> input ( 'description' ) ; $ product -> price = $ request -> input ( 'price' ) ; $ request -> input ( 'sale_price' ) == " " ? $ product -> sale_price = null : $ product -> sale_price = $ request -> input ( 'sale_price' ) ; $ product -> image_path = ImageManager :: saveImage ( $ request -> file ( 'product_image' ) ) ; $ product -> quantity = $ request -> input ( 'quantity' ) == " " ? $ product -> quantity = 0 : $ product -> quantity = $ request -> input ( 'quantity' ) ; $ product -> save ( ) ; return Redirect :: to ( '/admin/product' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .