@@ -7,8 +7,8 @@ |
||
7 | 7 | |
8 | 8 | class AdminClientsController extends Controller |
9 | 9 | { |
10 | - public function page(){ |
|
11 | - $clients = User::where('admin',false)->get(); |
|
12 | - return view('mongicommerce::admin.pages.clients',compact('clients')); |
|
10 | + public function page() { |
|
11 | + $clients = User::where('admin', false)->get(); |
|
12 | + return view('mongicommerce::admin.pages.clients', compact('clients')); |
|
13 | 13 | } |
14 | 14 | } |
@@ -8,11 +8,11 @@ |
||
8 | 8 | |
9 | 9 | class AdminOrderDetailsController |
10 | 10 | { |
11 | - public function page($order_id){ |
|
11 | + public function page($order_id) { |
|
12 | 12 | $order = Order::find($order_id); |
13 | 13 | $cliente = $order->user; |
14 | 14 | $products = $order->products; |
15 | 15 | $statuses = OrderStatus::all(); |
16 | - return view('mongicommerce::admin.pages.orders.order_details',compact('cliente','products','order','statuses')); |
|
16 | + return view('mongicommerce::admin.pages.orders.order_details', compact('cliente', 'products', 'order', 'statuses')); |
|
17 | 17 | } |
18 | 18 | } |
@@ -5,7 +5,7 @@ |
||
5 | 5 | |
6 | 6 | class DashboardController extends Controller |
7 | 7 | { |
8 | - public function page(){ |
|
8 | + public function page() { |
|
9 | 9 | return view('mongicommerce::admin.pages.dashboard'); |
10 | 10 | } |
11 | 11 | } |
@@ -8,9 +8,9 @@ |
||
8 | 8 | |
9 | 9 | class AdminOrdersController |
10 | 10 | { |
11 | - public function page(){ |
|
11 | + public function page() { |
|
12 | 12 | $orders = Order::all(); |
13 | 13 | $statuses = OrderStatus::all(); |
14 | - return view('mongicommerce::admin.pages.orders.orders_list',['orders' => $orders,'statuses'=> $statuses]); |
|
14 | + return view('mongicommerce::admin.pages.orders.orders_list', ['orders' => $orders, 'statuses'=> $statuses]); |
|
15 | 15 | } |
16 | 16 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | class ShopShipmentController extends Controller |
14 | 14 | { |
15 | - public function page(){ |
|
15 | + public function page() { |
|
16 | 16 | //if logged in |
17 | 17 | $piva = ''; |
18 | 18 | $rag_soc = ''; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $province = ''; |
26 | 26 | $city = ''; |
27 | 27 | $cap = ''; |
28 | - if(Auth::check()){ |
|
28 | + if (Auth::check()) { |
|
29 | 29 | $user = Auth::user(); |
30 | 30 | $piva = $user->piva; |
31 | 31 | $rag_soc = $user->company; |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | Template::MoveSessionToCart($user->id); |
42 | 42 | } |
43 | 43 | |
44 | - return view('mongicommerce.pages.shipment',compact( |
|
44 | + return view('mongicommerce.pages.shipment', compact( |
|
45 | 45 | 'piva', |
46 | 46 | 'rag_soc', |
47 | 47 | 'first_name', |
@@ -83,9 +83,9 @@ discard block |
||
83 | 83 | $city = $r->get('city'); |
84 | 84 | $cap = $r->get('cap'); |
85 | 85 | |
86 | - $user = User::where('email',$email_sped)->first(); |
|
86 | + $user = User::where('email', $email_sped)->first(); |
|
87 | 87 | //if user exist |
88 | - if($user){ |
|
88 | + if ($user) { |
|
89 | 89 | $user->piva = $piva; |
90 | 90 | $user->company = $rag_soc; |
91 | 91 | $user->first_name = $first_name; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $user->cap = $cap; |
99 | 99 | $user->save(); |
100 | 100 | //if user doesn't exist |
101 | - }else{ |
|
101 | + } else { |
|
102 | 102 | $user = new User(); |
103 | 103 | $user->piva = $piva; |
104 | 104 | $user->company = $rag_soc; |
@@ -98,7 +98,7 @@ |
||
98 | 98 | $user->cap = $cap; |
99 | 99 | $user->save(); |
100 | 100 | //if user doesn't exist |
101 | - }else{ |
|
101 | + } else{ |
|
102 | 102 | $user = new User(); |
103 | 103 | $user->piva = $piva; |
104 | 104 | $user->company = $rag_soc; |
@@ -4,7 +4,7 @@ |
||
4 | 4 | |
5 | 5 | class DefaultController extends Controller |
6 | 6 | { |
7 | - public function page(){ |
|
7 | + public function page() { |
|
8 | 8 | return view('mongicommerce.pages.default'); |
9 | 9 | } |
10 | 10 | } |
@@ -6,9 +6,9 @@ |
||
6 | 6 | |
7 | 7 | class ShopOrdersController extends Controller |
8 | 8 | { |
9 | - public function page(){ |
|
9 | + public function page() { |
|
10 | 10 | $user = Auth::user(); |
11 | - $orders = Order::where('user_id',$user->id)->get(); |
|
12 | - return view('mongicommerce.pages.user_orders',compact('user','orders')); |
|
11 | + $orders = Order::where('user_id', $user->id)->get(); |
|
12 | + return view('mongicommerce.pages.user_orders', compact('user', 'orders')); |
|
13 | 13 | } |
14 | 14 | } |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | |
6 | 6 | class ShopUserController extends Controller |
7 | 7 | { |
8 | - public function page(){ |
|
8 | + public function page() { |
|
9 | 9 | $user = Auth::user(); |
10 | 10 | $piva = $user->piva; |
11 | 11 | $rag_soc = $user->company; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $province = $user->province; |
19 | 19 | $city = $user->city; |
20 | 20 | $cap = $user->cap; |
21 | - return view('mongicommerce.pages.user_settings',compact('piva', |
|
21 | + return view('mongicommerce.pages.user_settings', compact('piva', |
|
22 | 22 | 'rag_soc', |
23 | 23 | 'first_name', |
24 | 24 | 'last_name', |
@@ -135,7 +135,7 @@ |
||
135 | 135 | |
136 | 136 | } |
137 | 137 | |
138 | - public function normalPayment(Request $r){ |
|
138 | + public function normalPayment(Request $r){ |
|
139 | 139 | $type = $r->get('type_payment'); |
140 | 140 | switch ($type){ |
141 | 141 | case 'iban': |
@@ -23,14 +23,14 @@ discard block |
||
23 | 23 | |
24 | 24 | class ShopPaymentController extends Controller |
25 | 25 | { |
26 | - public function page(){ |
|
26 | + public function page() { |
|
27 | 27 | $total = session('checkout.total'); |
28 | 28 | $api_stripe_key = AdminSetting::getStripeApiKey(); |
29 | 29 | $iban = AdminSetting::getIban(); |
30 | - return view('mongicommerce.pages.payment',compact('total','api_stripe_key','iban')); |
|
30 | + return view('mongicommerce.pages.payment', compact('total', 'api_stripe_key', 'iban')); |
|
31 | 31 | } |
32 | 32 | |
33 | - public function pay(Request $request){ |
|
33 | + public function pay(Request $request) { |
|
34 | 34 | |
35 | 35 | try { |
36 | 36 | $total = session('checkout.total'); |
@@ -38,16 +38,16 @@ discard block |
||
38 | 38 | $order_weight = session('checkout.total_weight'); |
39 | 39 | |
40 | 40 | $order_id = 0; |
41 | - $check_order = Order::orderBy('created_at','desc')->first(); |
|
42 | - if(is_null($check_order)){ |
|
41 | + $check_order = Order::orderBy('created_at', 'desc')->first(); |
|
42 | + if (is_null($check_order)) { |
|
43 | 43 | $order_id = 1; |
44 | - }else{ |
|
44 | + } else { |
|
45 | 45 | $order_id = $check_order->id + 1; |
46 | 46 | } |
47 | 47 | Stripe::setApiKey(AdminSetting::getStripeApiSecretKey()); |
48 | 48 | // Use Stripe's library to make requests... |
49 | - Charge::create ([ |
|
50 | - "amount" => number_format(($total*100) , 0, '', ''), |
|
49 | + Charge::create([ |
|
50 | + "amount" => number_format(($total * 100), 0, '', ''), |
|
51 | 51 | "currency" => "eur", |
52 | 52 | "source" => $request->stripeToken, |
53 | 53 | "description" => "Pagamento ordine N.".$order_id |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | $order->save(); |
69 | 69 | //save into order_products |
70 | 70 | |
71 | - $products = Cart::where('user_id',Auth::user()->id)->get(); |
|
72 | - foreach ($products as $product){ |
|
71 | + $products = Cart::where('user_id', Auth::user()->id)->get(); |
|
72 | + foreach ($products as $product) { |
|
73 | 73 | $order_products = new ProductsOrder(); |
74 | 74 | $order_products->order_id = $order->id; |
75 | 75 | $order_products->product_item_id = $product->product_item_id; |
@@ -87,15 +87,15 @@ discard block |
||
87 | 87 | Session::flash('success', 'Pagamento avvenuto con successo'); |
88 | 88 | return redirect(route('shop.user.orders')); |
89 | 89 | |
90 | - } catch(CardException $e) { |
|
90 | + } catch (CardException $e) { |
|
91 | 91 | |
92 | 92 | // Since it's a decline, \Stripe\Exception\CardException will be caught |
93 | - $error = '<h4>'.$e->getError()->message.'</h4><br>'; |
|
94 | - $error .= 'Status: ' . $e->getHttpStatus() . '<br>'; |
|
95 | - $error .= 'Type is:' . $e->getError()->type . '<br>'; |
|
96 | - $error .= 'Code is:' . $e->getError()->code . '<br>'; |
|
93 | + $error = '<h4>'.$e->getError()->message.'</h4><br>'; |
|
94 | + $error .= 'Status: '.$e->getHttpStatus().'<br>'; |
|
95 | + $error .= 'Type is:'.$e->getError()->type.'<br>'; |
|
96 | + $error .= 'Code is:'.$e->getError()->code.'<br>'; |
|
97 | 97 | // param is '' in this case |
98 | - $error .= 'Param is:' . $e->getError()->param . '<br>'; |
|
98 | + $error .= 'Param is:'.$e->getError()->param.'<br>'; |
|
99 | 99 | |
100 | 100 | Session::flash('error', $error); |
101 | 101 | return back(); |
@@ -135,9 +135,9 @@ discard block |
||
135 | 135 | |
136 | 136 | } |
137 | 137 | |
138 | - public function normalPayment(Request $r){ |
|
138 | + public function normalPayment(Request $r) { |
|
139 | 139 | $type = $r->get('type_payment'); |
140 | - switch ($type){ |
|
140 | + switch ($type) { |
|
141 | 141 | case 'iban': |
142 | 142 | $typePayment = TypePayment::BONIFICO; |
143 | 143 | $orderStatus = OrderStatus::ATTESA_PAGAMENTO; |
@@ -169,8 +169,8 @@ discard block |
||
169 | 169 | |
170 | 170 | //save into order_products |
171 | 171 | |
172 | - $products = Cart::where('user_id',Auth::user()->id)->get(); |
|
173 | - foreach ($products as $product){ |
|
172 | + $products = Cart::where('user_id', Auth::user()->id)->get(); |
|
173 | + foreach ($products as $product) { |
|
174 | 174 | $order_products = new ProductsOrder(); |
175 | 175 | $order_products->order_id = $order->id; |
176 | 176 | $order_products->product_item_id = $product->product_item_id; |
@@ -41,7 +41,7 @@ |
||
41 | 41 | $check_order = Order::orderBy('created_at','desc')->first(); |
42 | 42 | if(is_null($check_order)){ |
43 | 43 | $order_id = 1; |
44 | - }else{ |
|
44 | + } else{ |
|
45 | 45 | $order_id = $check_order->id + 1; |
46 | 46 | } |
47 | 47 | Stripe::setApiKey(AdminSetting::getStripeApiSecretKey()); |