app/Http/Controllers/Site/ProductsController.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 storeProduct(Request $request)
    {
        DB::table('products')->insert([
            'url'=>strtolower( preg_replace("/[^a-zA-Z0-9-]/", "-", 
            strtr(utf8_decode(trim($request->nameProduct)), 
            utf8_decode("áàãâéêíóôõúüñçÁÀÃÂÉÊÍÓÔÕÚÜÑÇ"),
            "aaaaeeiooouuncAAAAEEIOOOUUNC-"))),
            'name'=>$request->name,
            'color'=>$request->color,
            'type_id'=>$request->type,
            'size_id'=>$request->size,
            'price_buy'=>$request->pricebuy,
            'price_sell'=>$request->pricesell,
            'visible'=>"1",
            'created_at' => date("Y-m-d H:i:s"),  
            'updated_at' => date("Y-m-d H:i:s"),  
            'stock'=>$request->stock
        ]);
        return redirect('Produtos');
    }
public function storeProduct ( Request $ request ) { DB :: table ( 'products' ) -> insert ( [ 'url' => strtolower ( preg_replace ( " /[^a-zA-Z0-9-]/ " , " - " , strtr ( utf8_decode ( trim ( $ request -> nameProduct ) ) , utf8_decode ( " áàãâéêíóôõúüñçÁÀÃÂÉÊÍÓÔÕÚÜÑÇ"), " aaaaeeiooouuncAAAAEEIOOOUUNC- " ) ) ) , 'name' => $ request -> name , 'color' => $ request -> color , 'type_id' => $ request -> type , 'size_id' => $ request -> size , 'price_buy' => $ request -> pricebuy , 'price_sell' => $ request -> pricesell , 'visible' => " 1 " , 'created_at' => date ( " Y-m-d H:i:s " ) , 'updated_at' => date ( " Y-m-d H:i:s " ) , 'stock' => $ request -> stock ] ) ; return redirect ( 'Produtos' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .