ChatBot Integration

This commit is contained in:
UronShrestha
2024-07-10 13:46:42 +05:45
parent f4aab0bed3
commit c566bf9c27
15 changed files with 986 additions and 27 deletions

View File

@ -2,6 +2,7 @@
namespace App\Http\Controllers;
use App\Mail\Testing;
use App\Models\User;
use Illuminate\Support\Facades\DB;
@ -12,6 +13,8 @@ use App\Models\Order;
use App\Models\OrderItem;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Mail;
class MainController extends Controller
{
@ -188,34 +191,22 @@ class MainController extends Controller
public function myOrders()
{
$customerId = auth()->id(); // Assuming you are using authentication
$orders = Order::where('customerId', session()->get('id'))->get();
if (session()->has('id')) {
$orders = Order::where('customerId', session()->get('id'))->get();
$items = DB::table('products')
$items = DB::table('products')
->join('order_items', 'order_items.productId', '=', 'products.id')
->select('products.name', 'products.picture', 'products.price', 'order_items.quantity', 'order_items.orderId as order_id')
->whereIn('order_items.orderId', $orders->pluck('id'))
->get();
return view('orders', compact('orders', 'items'));
->join('order_items', 'order_items.productId', '=', 'products.id')
->select('products.name', 'products.picture', 'products.*')
->get();
return view('orders', compact('orders', 'items'));
}
return view('login');
}
// public function myOrders()
// {
// $customerId = auth()->id(); // Assuming you are using authentication
// $orders = Order::where('customerId', session()->get('id'))->get();
// $items = DB::table('products')
// ->join('order_items', 'order_items.productId', '=', 'products.id')
// ->select('products.name', 'products.picture', 'products.price', 'order_items.quantity', 'order_items.orderId as order_id')
// ->whereIn('order_items.orderId', $orders->pluck('id'))
// ->get();
// return view('orders', compact('orders', 'items'));
// }
public function profile()
{
if (session()->has('id')) {
@ -283,6 +274,15 @@ class MainController extends Controller
return view('checkout');
}
public function testMail()
{
$details = [
'title' => 'Mail from Uron Shrestha',
'message' => 'This is for testing mail using smtp in Laravel!'
];
Mail::to("yuron.stha57@gmail.com")->send(new Testing($details));
return redirect('/');
}
public function shop()