How to Setup Database in Laravel Vapor?
This simple article demonstrates of laravel vapor database example. if you have question about configure database in laravel vapor then i will give simple example with solution. we will help you to give example of how to setup database in laravel vapor. We will look at example of laravel vapor database example.
In this post i will give you simple example of how to configure database with laravel vapor. we will install laravel ui package and make auth system. then we will create database on vapor and run migration and see simple authentication.
My previous post about How to Deploy Project with Laravel Vapor? from here we will proceed step by step.
Step 1: Install Laravel ui
In this step we will install laravel ui composer package. so let's run bellow command:
composer require laravel/ui
Step 2: Generate Auth Scaffolding
After installing laravel ui, we need to generate auth scaffolding using bellow command. then we will install npm and migration.
php artisan ui bootstrap --auth
after that install npm command:
npm install && npm run dev
after that run migration command:
php artisan migrate
Step 3: Create Database to Vapor
after done locally, we need to create database on vapor. on left side there is a option call database and click on it. where you can manage all database. you can also create from there as bellow:
Step 4: Setup Database Locally and Deploy
now we need to use that database on vapor.yml file and deploy project. so let's add vapor database name here and deploy it.
- 'COMPOSER_MIRROR_PATH_REPOS=1 composer install --no-dev'
- 'php artisan migrate --force'
- 'COMPOSER_MIRROR_PATH_REPOS=1 composer install'
now just deploy it.
php vendor/bin/vapor deploy
now you can open staging url as bellow:
you will can register and login:
You can also Run Migration on Vapor
we need to run migration on vapor command. so let's go on vapor staging command tab:
Click on Run command and add migration command there:
After run command, you will see layout as bellow:
i hope it can help you...
We are Recommending you
- Laravel Http Curl Get Request Example
- Laravel Sweet Alert Confirm Delete Example
- How to Restore Deleted Records in Laravel?
- How to Select Custom Column with Value in Laravel Query?
- Laravel Table Row Inline Editing Tutorial
- Laravel Shopping Add to Cart with Ajax Example
- Laravel 8 User Roles and Permissions Tutorial
- Laravel 8 Stripe Payment Gateway Integration Example
- Laravel 8 Resize Image Before Upload Example
- Laravel 8 Markdown | Laravel 8 Send Email using Markdown Example
- Laravel 8 Livewire CRUD with Jetstream & Tailwind CSS