Application Laravel integrated with OpenAI's ChatGPT, with Authentication and Cache.
composer update
./vendor/bin/sail build
./vendor/bin/sail up -d
http://localhost
curl -s "https://laravel.build/example-app?with=mysql,redis" | bash
sail up -d
composer require laravel/breeze --dev
php artisan breeze:install
php artisan migrate
npm install
npm run dev
plugins: [...]
watch: {
usePolling: true,
origin: 'http://localhost'
},
server: {
hmr: {
host: 'localhost'
}
}
php artisan breeze:install --dark
composer require openai-php/client
echo -e '\nOPEN_AI_KEY="CHANGE_TO_YOUR_KEY..."' >> .env
sail artisan make:controller OpenAIController
npm run dev
Route::get('/openai', [OpenAIController::class, 'index'])->name('openai.index');
New Link for menu access, on file ./resources/views/layouts/navigation.blade.php add:
<div class="hidden space-x-8 sm:-my-px sm:ml-10 sm:flex">
<x-nav-link
:href="route('openai.index')"
:active="request()->routeIs('openai.index')"
>
{{ __('OpenAI') }}
</x-nav-link>
</div>
New file ./app/Http/Controllers/OpenAIController.php
New file ./resources/views/openai/index.blade.php
Nuno Maduro - OpenAI-PHP dependecy