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

@ -0,0 +1,57 @@
<?php
namespace App\Http\Controllers;
use BotMan\BotMan\BotMan;
use BotMan\BotMan\Messages\Incoming\Answer;
use Illuminate\Http\Request;
class BotManController extends Controller
{
public function handle()
{
$botman = app('botman');
$botman->hears('{message}', function ($botman, $message) {
if ($message == 'hi' || $message == 'Hi' || $message == 'Hello' || $message == 'hello') {
$this->askName($botman);
} else {
$botman->reply("Start the conversation saying Hi.");
}
});
$botman->listen();
}
public function askName($botman)
{
$botman->ask('Hello! What is your name?', function (Answer $answer, $conversation) {
$name = $answer->getText();
$this->say("Nice to meet you " . $name);
$conversation->ask('Can you tell us your phone number?', function (Answer $answer, $conversation) {
$phoneNumber = $answer->getText();
$this->say("Your phone number is " . $phoneNumber);
$conversation->ask('Can you tell us your email?', function (Answer $answer, $conversation) {
$email = $answer->getText();
$this->say("Your email is " . $email);
$conversation->ask('Confirm your Email (Y/N):', function (Answer $answer, $conversation) {
$confirmEmail = $answer->getText();
if ($answer == 'Y' || $answer == "y") {
$this->say("we got your details");
} elseif ($answer == 'N' || $answer == "n") {
$this->say("Please confirm your email");
$conversation->ask('Write your email again.', function (Answer $answer, $conversation) {
$email = $answer->getText();
$this->say("Your email is " . $email);
});
}
});
});
});
});
}
}

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,32 +191,20 @@ class MainController extends Controller
public function myOrders()
{
$customerId = auth()->id(); // Assuming you are using authentication
if (session()->has('id')) {
$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'))
->select('products.name', 'products.picture', 'products.*')
->get();
return view('orders', compact('orders', 'items'));
}
// 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'));
// }
return view('login');
}
public function profile()
@ -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()

54
app/Mail/Testing.php Normal file
View File

@ -0,0 +1,54 @@
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class Testing extends Mailable
{
use Queueable, SerializesModels;
/**
* Create a new message instance.
*/
public $details;
public function __construct($details)
{
$this->details = $details;
}
/**
* Get the message envelope.
*/
public function envelope(): Envelope
{
return new Envelope(
subject: 'Testing',
);
}
/**
* Get the message content definition.
*/
public function content(): Content
{
return new Content(
view: 'Mails.testing',
);
}
/**
* Get the attachments for the message.
*
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
*/
public function attachments(): array
{
return [];
}
}

11
app/Models/UserChat.php Normal file
View File

@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class UserChat extends Model
{
use HasFactory;
}

View File

@ -6,6 +6,8 @@
"license": "MIT",
"require": {
"php": "^8.2",
"botman/botman": "^2.8",
"botman/driver-web": "^1.5",
"laravel/framework": "^11.9",
"laravel/tinker": "^2.9",
"stripe/stripe-php": "^15.1"

743
composer.lock generated
View File

@ -4,8 +4,153 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "14e8cdf03b6b5d46f815f7145406604e",
"content-hash": "05876a321dec0a7d45c60fe1b2f0c833",
"packages": [
{
"name": "botman/botman",
"version": "v2.8.3",
"source": {
"type": "git",
"url": "https://github.com/botman/botman.git",
"reference": "800f0f89149abdd04ad4aa57b789376256bf1f1b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/botman/botman/zipball/800f0f89149abdd04ad4aa57b789376256bf1f1b",
"reference": "800f0f89149abdd04ad4aa57b789376256bf1f1b",
"shasum": ""
},
"require": {
"illuminate/support": "^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0",
"laravel/serializable-closure": "^1.0",
"mpociot/pipeline": "^1.0.2",
"php": ">=7.1",
"psr/container": "^1.0 || ^2.0",
"react/socket": "~1.0",
"spatie/macroable": "^1.0",
"symfony/http-foundation": "^2.8 || ^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0"
},
"require-dev": {
"codeigniter/framework": "~3.0",
"dms/phpunit-arraysubset-asserts": "^0.4.0",
"doctrine/cache": "^1.6",
"ext-curl": "*",
"mockery/mockery": "^1.1",
"orchestra/testbench": "^3.4 || ^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0",
"phpunit/phpunit": "^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0",
"symfony/cache": "^3.4.35 || ^4.3.7 || ^5.0"
},
"suggest": {
"doctrine/cache": "Use any Doctrine cache driver for cache",
"symfony/cache": "Use any Symfony cache driver for cache"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"
},
"laravel": {
"providers": [
"BotMan\\BotMan\\BotManServiceProvider"
],
"aliases": {
"BotMan": "BotMan\\BotMan\\Facades\\BotMan"
}
}
},
"autoload": {
"psr-4": {
"BotMan\\BotMan\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Marcel Pociot",
"email": "m.pociot@gmail.com"
}
],
"description": "Create messaging bots in PHP with ease.",
"homepage": "http://github.com/botman/botman",
"keywords": [
"Botman",
"bot",
"chatbot"
],
"support": {
"issues": "https://github.com/botman/botman/issues",
"source": "https://github.com/botman/botman/tree/v2.8.3"
},
"time": "2024-03-13T07:59:56+00:00"
},
{
"name": "botman/driver-web",
"version": "v1.5.3",
"source": {
"type": "git",
"url": "https://github.com/botman/driver-web.git",
"reference": "45b3bde9c5af0f52d9a893a3793740e3304015af"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/botman/driver-web/zipball/45b3bde9c5af0f52d9a893a3793740e3304015af",
"reference": "45b3bde9c5af0f52d9a893a3793740e3304015af",
"shasum": ""
},
"require": {
"botman/botman": ">=2.0",
"php": ">=7.0"
},
"require-dev": {
"botman/driver-facebook": "~2.0",
"botman/studio-addons": "~1.0",
"ext-curl": "*",
"illuminate/support": "~5.5.0",
"mockery/mockery": "^1.1",
"phpunit/phpunit": "~5.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
},
"laravel": {
"providers": [
"BotMan\\Drivers\\Web\\Providers\\WebServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"BotMan\\Drivers\\Web\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Marcel Pociot",
"email": "m.pociot@gmail.com"
}
],
"description": "Web driver for BotMan",
"homepage": "http://github.com/botman/driver-web",
"keywords": [
"Botman",
"bot",
"web"
],
"support": {
"issues": "https://github.com/botman/driver-web/issues",
"source": "https://github.com/botman/driver-web/tree/v1.5.3"
},
"time": "2022-05-01T20:39:28+00:00"
},
{
"name": "brick/math",
"version": "0.12.1",
@ -506,6 +651,53 @@
],
"time": "2023-10-06T06:47:41+00:00"
},
{
"name": "evenement/evenement",
"version": "v3.0.2",
"source": {
"type": "git",
"url": "https://github.com/igorw/evenement.git",
"reference": "0a16b0d71ab13284339abb99d9d2bd813640efbc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/igorw/evenement/zipball/0a16b0d71ab13284339abb99d9d2bd813640efbc",
"reference": "0a16b0d71ab13284339abb99d9d2bd813640efbc",
"shasum": ""
},
"require": {
"php": ">=7.0"
},
"require-dev": {
"phpunit/phpunit": "^9 || ^6"
},
"type": "library",
"autoload": {
"psr-4": {
"Evenement\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Igor Wiedler",
"email": "igor@wiedler.ch"
}
],
"description": "Événement is a very simple event dispatching library for PHP",
"keywords": [
"event-dispatcher",
"event-emitter"
],
"support": {
"issues": "https://github.com/igorw/evenement/issues",
"source": "https://github.com/igorw/evenement/tree/v3.0.2"
},
"time": "2023-08-08T05:53:35+00:00"
},
{
"name": "fruitcake/php-cors",
"version": "v1.3.0",
@ -1916,6 +2108,54 @@
],
"time": "2024-06-28T09:40:51+00:00"
},
{
"name": "mpociot/pipeline",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/mpociot/pipeline.git",
"reference": "3584db4a0de68067b2b074edfadf6a48b5603a6b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mpociot/pipeline/zipball/3584db4a0de68067b2b074edfadf6a48b5603a6b",
"reference": "3584db4a0de68067b2b074edfadf6a48b5603a6b",
"shasum": ""
},
"require": {
"php": ">=5.6.0"
},
"require-dev": {
"phpunit/phpunit": "~5.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Mpociot\\Pipeline\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Marcel Pociot",
"email": "m.pociot@gmail.com"
}
],
"description": "Simple PHP middleware pipeline",
"homepage": "http://github.com/mpociot/pipeline",
"keywords": [
"middleware",
"pipeline"
],
"support": {
"issues": "https://github.com/mpociot/pipeline/issues",
"source": "https://github.com/mpociot/pipeline/tree/1.0.2"
},
"time": "2017-04-21T13:22:05+00:00"
},
{
"name": "nesbot/carbon",
"version": "3.6.0",
@ -3107,6 +3347,507 @@
],
"time": "2024-04-27T21:32:50+00:00"
},
{
"name": "react/cache",
"version": "v1.2.0",
"source": {
"type": "git",
"url": "https://github.com/reactphp/cache.git",
"reference": "d47c472b64aa5608225f47965a484b75c7817d5b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/cache/zipball/d47c472b64aa5608225f47965a484b75c7817d5b",
"reference": "d47c472b64aa5608225f47965a484b75c7817d5b",
"shasum": ""
},
"require": {
"php": ">=5.3.0",
"react/promise": "^3.0 || ^2.0 || ^1.1"
},
"require-dev": {
"phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35"
},
"type": "library",
"autoload": {
"psr-4": {
"React\\Cache\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christian Lück",
"email": "christian@clue.engineering",
"homepage": "https://clue.engineering/"
},
{
"name": "Cees-Jan Kiewiet",
"email": "reactphp@ceesjankiewiet.nl",
"homepage": "https://wyrihaximus.net/"
},
{
"name": "Jan Sorgalla",
"email": "jsorgalla@gmail.com",
"homepage": "https://sorgalla.com/"
},
{
"name": "Chris Boden",
"email": "cboden@gmail.com",
"homepage": "https://cboden.dev/"
}
],
"description": "Async, Promise-based cache interface for ReactPHP",
"keywords": [
"cache",
"caching",
"promise",
"reactphp"
],
"support": {
"issues": "https://github.com/reactphp/cache/issues",
"source": "https://github.com/reactphp/cache/tree/v1.2.0"
},
"funding": [
{
"url": "https://opencollective.com/reactphp",
"type": "open_collective"
}
],
"time": "2022-11-30T15:59:55+00:00"
},
{
"name": "react/dns",
"version": "v1.13.0",
"source": {
"type": "git",
"url": "https://github.com/reactphp/dns.git",
"reference": "eb8ae001b5a455665c89c1df97f6fb682f8fb0f5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/dns/zipball/eb8ae001b5a455665c89c1df97f6fb682f8fb0f5",
"reference": "eb8ae001b5a455665c89c1df97f6fb682f8fb0f5",
"shasum": ""
},
"require": {
"php": ">=5.3.0",
"react/cache": "^1.0 || ^0.6 || ^0.5",
"react/event-loop": "^1.2",
"react/promise": "^3.2 || ^2.7 || ^1.2.1"
},
"require-dev": {
"phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36",
"react/async": "^4.3 || ^3 || ^2",
"react/promise-timer": "^1.11"
},
"type": "library",
"autoload": {
"psr-4": {
"React\\Dns\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christian Lück",
"email": "christian@clue.engineering",
"homepage": "https://clue.engineering/"
},
{
"name": "Cees-Jan Kiewiet",
"email": "reactphp@ceesjankiewiet.nl",
"homepage": "https://wyrihaximus.net/"
},
{
"name": "Jan Sorgalla",
"email": "jsorgalla@gmail.com",
"homepage": "https://sorgalla.com/"
},
{
"name": "Chris Boden",
"email": "cboden@gmail.com",
"homepage": "https://cboden.dev/"
}
],
"description": "Async DNS resolver for ReactPHP",
"keywords": [
"async",
"dns",
"dns-resolver",
"reactphp"
],
"support": {
"issues": "https://github.com/reactphp/dns/issues",
"source": "https://github.com/reactphp/dns/tree/v1.13.0"
},
"funding": [
{
"url": "https://opencollective.com/reactphp",
"type": "open_collective"
}
],
"time": "2024-06-13T14:18:03+00:00"
},
{
"name": "react/event-loop",
"version": "v1.5.0",
"source": {
"type": "git",
"url": "https://github.com/reactphp/event-loop.git",
"reference": "bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/event-loop/zipball/bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354",
"reference": "bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36"
},
"suggest": {
"ext-pcntl": "For signal handling support when using the StreamSelectLoop"
},
"type": "library",
"autoload": {
"psr-4": {
"React\\EventLoop\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christian Lück",
"email": "christian@clue.engineering",
"homepage": "https://clue.engineering/"
},
{
"name": "Cees-Jan Kiewiet",
"email": "reactphp@ceesjankiewiet.nl",
"homepage": "https://wyrihaximus.net/"
},
{
"name": "Jan Sorgalla",
"email": "jsorgalla@gmail.com",
"homepage": "https://sorgalla.com/"
},
{
"name": "Chris Boden",
"email": "cboden@gmail.com",
"homepage": "https://cboden.dev/"
}
],
"description": "ReactPHP's core reactor event loop that libraries can use for evented I/O.",
"keywords": [
"asynchronous",
"event-loop"
],
"support": {
"issues": "https://github.com/reactphp/event-loop/issues",
"source": "https://github.com/reactphp/event-loop/tree/v1.5.0"
},
"funding": [
{
"url": "https://opencollective.com/reactphp",
"type": "open_collective"
}
],
"time": "2023-11-13T13:48:05+00:00"
},
{
"name": "react/promise",
"version": "v3.2.0",
"source": {
"type": "git",
"url": "https://github.com/reactphp/promise.git",
"reference": "8a164643313c71354582dc850b42b33fa12a4b63"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/promise/zipball/8a164643313c71354582dc850b42b33fa12a4b63",
"reference": "8a164643313c71354582dc850b42b33fa12a4b63",
"shasum": ""
},
"require": {
"php": ">=7.1.0"
},
"require-dev": {
"phpstan/phpstan": "1.10.39 || 1.4.10",
"phpunit/phpunit": "^9.6 || ^7.5"
},
"type": "library",
"autoload": {
"files": [
"src/functions_include.php"
],
"psr-4": {
"React\\Promise\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jan Sorgalla",
"email": "jsorgalla@gmail.com",
"homepage": "https://sorgalla.com/"
},
{
"name": "Christian Lück",
"email": "christian@clue.engineering",
"homepage": "https://clue.engineering/"
},
{
"name": "Cees-Jan Kiewiet",
"email": "reactphp@ceesjankiewiet.nl",
"homepage": "https://wyrihaximus.net/"
},
{
"name": "Chris Boden",
"email": "cboden@gmail.com",
"homepage": "https://cboden.dev/"
}
],
"description": "A lightweight implementation of CommonJS Promises/A for PHP",
"keywords": [
"promise",
"promises"
],
"support": {
"issues": "https://github.com/reactphp/promise/issues",
"source": "https://github.com/reactphp/promise/tree/v3.2.0"
},
"funding": [
{
"url": "https://opencollective.com/reactphp",
"type": "open_collective"
}
],
"time": "2024-05-24T10:39:05+00:00"
},
{
"name": "react/socket",
"version": "v1.15.0",
"source": {
"type": "git",
"url": "https://github.com/reactphp/socket.git",
"reference": "216d3aec0b87f04a40ca04f481e6af01bdd1d038"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/socket/zipball/216d3aec0b87f04a40ca04f481e6af01bdd1d038",
"reference": "216d3aec0b87f04a40ca04f481e6af01bdd1d038",
"shasum": ""
},
"require": {
"evenement/evenement": "^3.0 || ^2.0 || ^1.0",
"php": ">=5.3.0",
"react/dns": "^1.11",
"react/event-loop": "^1.2",
"react/promise": "^3 || ^2.6 || ^1.2.1",
"react/stream": "^1.2"
},
"require-dev": {
"phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36",
"react/async": "^4 || ^3 || ^2",
"react/promise-stream": "^1.4",
"react/promise-timer": "^1.10"
},
"type": "library",
"autoload": {
"psr-4": {
"React\\Socket\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christian Lück",
"email": "christian@clue.engineering",
"homepage": "https://clue.engineering/"
},
{
"name": "Cees-Jan Kiewiet",
"email": "reactphp@ceesjankiewiet.nl",
"homepage": "https://wyrihaximus.net/"
},
{
"name": "Jan Sorgalla",
"email": "jsorgalla@gmail.com",
"homepage": "https://sorgalla.com/"
},
{
"name": "Chris Boden",
"email": "cboden@gmail.com",
"homepage": "https://cboden.dev/"
}
],
"description": "Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP",
"keywords": [
"Connection",
"Socket",
"async",
"reactphp",
"stream"
],
"support": {
"issues": "https://github.com/reactphp/socket/issues",
"source": "https://github.com/reactphp/socket/tree/v1.15.0"
},
"funding": [
{
"url": "https://opencollective.com/reactphp",
"type": "open_collective"
}
],
"time": "2023-12-15T11:02:10+00:00"
},
{
"name": "react/stream",
"version": "v1.4.0",
"source": {
"type": "git",
"url": "https://github.com/reactphp/stream.git",
"reference": "1e5b0acb8fe55143b5b426817155190eb6f5b18d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/stream/zipball/1e5b0acb8fe55143b5b426817155190eb6f5b18d",
"reference": "1e5b0acb8fe55143b5b426817155190eb6f5b18d",
"shasum": ""
},
"require": {
"evenement/evenement": "^3.0 || ^2.0 || ^1.0",
"php": ">=5.3.8",
"react/event-loop": "^1.2"
},
"require-dev": {
"clue/stream-filter": "~1.2",
"phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36"
},
"type": "library",
"autoload": {
"psr-4": {
"React\\Stream\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christian Lück",
"email": "christian@clue.engineering",
"homepage": "https://clue.engineering/"
},
{
"name": "Cees-Jan Kiewiet",
"email": "reactphp@ceesjankiewiet.nl",
"homepage": "https://wyrihaximus.net/"
},
{
"name": "Jan Sorgalla",
"email": "jsorgalla@gmail.com",
"homepage": "https://sorgalla.com/"
},
{
"name": "Chris Boden",
"email": "cboden@gmail.com",
"homepage": "https://cboden.dev/"
}
],
"description": "Event-driven readable and writable streams for non-blocking I/O in ReactPHP",
"keywords": [
"event-driven",
"io",
"non-blocking",
"pipe",
"reactphp",
"readable",
"stream",
"writable"
],
"support": {
"issues": "https://github.com/reactphp/stream/issues",
"source": "https://github.com/reactphp/stream/tree/v1.4.0"
},
"funding": [
{
"url": "https://opencollective.com/reactphp",
"type": "open_collective"
}
],
"time": "2024-06-11T12:45:25+00:00"
},
{
"name": "spatie/macroable",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/spatie/macroable.git",
"reference": "7a99549fc001c925714b329220dea680c04bfa48"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/macroable/zipball/7a99549fc001c925714b329220dea680c04bfa48",
"reference": "7a99549fc001c925714b329220dea680c04bfa48",
"shasum": ""
},
"require": {
"php": "^7.2|^8.0"
},
"require-dev": {
"phpunit/phpunit": "^8.0|^9.3"
},
"type": "library",
"autoload": {
"psr-4": {
"Spatie\\Macroable\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Freek Van der Herten",
"email": "freek@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
}
],
"description": "A trait to dynamically add methods to a class",
"homepage": "https://github.com/spatie/macroable",
"keywords": [
"macroable",
"spatie"
],
"support": {
"issues": "https://github.com/spatie/macroable/issues",
"source": "https://github.com/spatie/macroable/tree/1.0.1"
},
"time": "2020-11-03T10:15:05+00:00"
},
{
"name": "stripe/stripe-php",
"version": "v15.1.0",

6
config/botman/config.php Normal file
View File

@ -0,0 +1,6 @@
<?php
return [
'conversation_cache_time' => 40,
'user_cache_time' => 30,
];

7
config/botman/web.php Normal file
View File

@ -0,0 +1,7 @@
<?php
return [
'matchingData' => [
'driver' => 'web',
],
];

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('userChat', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->string('phone');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('userChat');
}
};

BIN
public/img/icon/chatbot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 475 B

View File

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<h1>
{{ $details['title'] }}
</h1>
<p>
{{ $details['message'] }}
</p>
</body>
</html>

View File

@ -91,6 +91,18 @@
<script src="https://code.jquery.com/jquery-3.6.3.min.js"
integrity="sha256-pvPw+upLPUjgMXY0G+8O0xUf+/Im1MZjXxxgOcBQBXU=" crossorigin="anonymous"></script>
{{-- Botman --}}
<script src='https://cdn.jsdelivr.net/npm/botman-web-widget@0/build/js/widget.js'></script>
{{-- Botman Script --}}
<script>
var botmanWidget = {
// frameEndpoint: '/iFrameUrl'
aboutText: 'Bibhuti',
introMessage: 'Type Hi to start conversation.',
};
</script>
@ -110,14 +122,14 @@
if (successMessage) {
successMessage.style.display = 'none';
}
}, 2000); // 3000 milliseconds = 3 seconds
}, 2000);
setTimeout(function() {
var errorMessage = document.getElementById('error-message');
if (errorMessage) {
errorMessage.style.display = 'none';
}
}, 2000); // 2000 milliseconds = 3 seconds
}, 2000);
});
</script>
</body>

View File

@ -30,6 +30,11 @@
<script src="https://stackpath.bootstrapcdn.com/bootstrap/5.1.3/js/bootstrap.bundle.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
{{-- botman --}}
{{-- <link rel="stylesheet" type="text/css"
href="https://cdn.jsdelivr.net/npm/botman-web-widget@0/build/assets/css/chat.min.css"> --}}
</head>
<!-- Include the Stripe.js library -->
@ -135,6 +140,9 @@
<li><a href="{{ route('checkout') }}">Check Out</a></li>
<li><a href="{{ route('myOrders') }}">My Orders</a></li>
<li><a href="{{ route('profile') }}">Profile</a></li>
<li><a href="{{ route('testMail') }}">Email </a></li>
</ul>
</li>
@ -144,6 +152,8 @@
</div>
<div class="col-lg-3 col-md-3">
<div class="header__nav__option">
{{-- <a href="{{ route('botman') }}"><img src="{{ URL::asset('img/icon/chatbot.png') }}"
alt=""></a> --}}
<a href="#" class="search-switch"><img src="{{ URL::asset('img/icon/search.png') }}"
alt=""></a>
<a href="#"><img src="{{ URL::asset('img/icon/heart.png') }}" alt=""></a>

View File

@ -7,7 +7,7 @@
<div class="breadcrumb__text">
<h4>Shop</h4>
<div class="breadcrumb__links">
<a href="./index.html">Home</a>
<a href="{{ route('/') }}">Home</a>
<span>Shop</span>
</div>
</div>

View File

@ -1,7 +1,9 @@
<?php
use App\Http\Controllers\MainController;
use App\Http\Controllers\BotManController;
use App\Http\Controllers\StripePaymentController;
use BotMan\BotMan\Facades\BotMan;
use Illuminate\Support\Facades\Route;
@ -38,3 +40,9 @@ Route::controller(StripePaymentController::class)->group(function () {
Route::get('stripe', 'stripe');
Route::post('stripe', 'stripePost')->name('stripe.post');
});
// Route::get('/testMail', [MainController::class, 'testMail'])->name('testMail');
Route::get('/testMail', [MainController::class, 'testMail'])->name('testMail');
Route::match(['get', 'post'], '/botman', [BotManController::class, 'handle'])->name('botman');