/** * Show the form for creating a new resource. * * @return Response */ public function create() { // $user_id = 1; // $productsCount = Products::count(); // $product = Products::get(); // $ordersCount = DB::select('select count(*) as say from orders where cast(created_at as DATE) = ?', array(Carbon::now()->format('Y-m-d'))); // // if ($productsCount != ($ordersCount[0]->say)) { // foreach ($product as $key => $pro) { //// $ordersCount = DB::select('select count(*) as say from orders where cast(created_at as DATE) = ? and ProductName = ? ', array(Carbon::now()->format('Y-m-d'), $pro->Name)); ////dd(Carbon::now()->format('Y-m-d h:i:s')); //// dd(Carbon::now()); // $today = Carbon::now()->format('Y-m-d h:n:s'); // $ifnotinsert = DB::insert(DB::raw("INSERT INTO orders (ProductName,CustomerId,CustomerName,quantity,Alish,Satish,Income,created_at,updated_at,user_id) //SELECT * FROM (SELECT '$pro->Name' as name, '$pro->CustomerId' as cusid, '$pro->CustomerId' as cusname, 0 as quantity , '$pro->Alish' as alish , '$pro->Satish' as satish, '$pro->Income' as income, '$today' as created_at, '$today' as updated_at,0 as user_id) AS tmp //WHERE NOT EXISTS ( // SELECT * FROM orders WHERE ProductName = '$pro->Name' and CustomerId = '$pro->CustomerId' and Format(Alish,2) = Format('$pro->Alish',2) AND //Format(Satish,2)= Format('$pro->Satish',2)) LIMIT 1")); // // } // } $CustomerName = Customers::lists('name', 'id'); $CategoryName = Categories::lists('name', 'id'); return view('orders.newAlish', compact('CustomerName', $CustomerName), compact('CategoryName')); }
/** * Show the form for creating a new resource. * * @return Response */ public function create() { $CategoryName = Categories::lists('name', 'id'); $CustomerName = Customers::lists('name', 'id'); return view('products.create', compact('CustomerName', $CustomerName), compact('CategoryName')); }
/** * Show the form for creating a new resource. * * @return Response */ public function create() { $CustomerName = Customers::lists('name', 'id'); // dd($CustomerName); return view('purchase.create', compact('CustomerName')); }