Skip to content

Commit 5d51940

Browse files
committed
pdf
1 parent 32d0b3f commit 5d51940

9 files changed

+794
-25
lines changed

app/Http/Controllers/CartController.php

+51
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Gloudemans\Shoppingcart\Facades\Cart;
88
use Illuminate\Http\Request;
99
use Illuminate\Support\Facades\DB;
10+
use PDF;
1011

1112
class CartController extends Controller
1213
{
@@ -148,6 +149,56 @@ public function panding_order(){
148149
return view('dashbord.Order.pandingorder',compact('panding_order'));
149150
}
150151

152+
//complete order
153+
public function complete_order(){
154+
$complete_order = DB::table('orders')
155+
->join('customers','orders.customar_id','customers.id')
156+
->select('customers.name','customers.email','orders.*')
157+
->where('order_status','complete')->get();
158+
return view('dashbord.Order.completeorder',compact('complete_order'));
159+
}
160+
161+
//view selected order full dateils
162+
public function view_panding_order($id){
163+
$order = DB::table('orders')
164+
->join('customers','orders.customar_id','customers.id')
165+
->select('customers.name','customers.email','customers.address','customers.phone','orders.*')
166+
->where('orders.id',$id)->first();
167+
$order_datils = DB::table('orderdatils')
168+
->join('products','orderdatils.product_id','products.id')
169+
->select('products.product_code','products.product_name','orderdatils.*')
170+
->where('order_id',$id)->get();
171+
$setting = Setting::latest()->first();
172+
return view('dashbord.Order.invoice',compact('order','order_datils','setting'));
173+
}
151174

175+
public function order_status_change($id)
176+
{
177+
178+
DB::table('orders')->where('id',$id)->update([
179+
'order_status' => 'complete'
180+
]);
181+
$notification = array(
182+
'message' => 'Complete This Order',
183+
'alert-type' => 'success'
184+
);
185+
return redirect()->route('dashboard')->with($notification);
186+
}
187+
188+
public function download_invoice($id)
189+
{
190+
$order = DB::table('orders')
191+
->join('customers','orders.customar_id','customers.id')
192+
->select('customers.name','customers.email','customers.address','customers.phone','orders.*')
193+
->where('orders.id',$id)->first();
194+
$order_datils = DB::table('orderdatils')
195+
->join('products','orderdatils.product_id','products.id')
196+
->select('products.product_code','products.product_name','orderdatils.*')
197+
->where('order_id',$id)->get();
198+
$setting = Setting::latest()->first();
199+
200+
$pdf = PDF::loadView('dashbord.Order.download',compact('order','order_datils','setting'));
201+
return $pdf->download('Invoice.pdf');
202+
}
152203

153204
}

composer.json

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"license": "MIT",
77
"require": {
88
"php": "^8.1",
9+
"barryvdh/laravel-dompdf": "^2.0",
910
"guzzlehttp/guzzle": "^7.2",
1011
"intervention/image": "^2.7",
1112
"laravel/framework": "^10.10",

0 commit comments

Comments
 (0)