Category Archives: Blog

Blog

Laravel 7 Vue JS File Upload Example

In this Laravel 7 Vue JS File Upload Example tutorial, I’ll show you how to upload file using Vue Js in laravel. In this tutorial you will learn to create file upload functionality using Vue Js in laravel.

Laravel 7 Vue JS File Upload Example

  • Step 1: Download Laravel Fresh App
  • Step 2: Add Database Detail
  • Step 3: Create Model And Migration
  • Step 4: NPM Configuration
  • Step 5: Add Routes
  • Step 6: Create Controller By Command
  • Step 7: Create Vue Component
  • Step 8: Register Vue App
  • Step 9: Run Development Server

Step 1: Download Laravel Fresh App

First of all we need to create a fresh laravel project, download and install Laravel using the below command

Step 2: Add Database Details

Now, lets create a MySQL database and connect it with laravel application. After creating database we need to set database credential in application’s .env file.

Step 3: Create Model And Migration

Now, in this step we will create model and migration file for form. Please run the following command:

This command will create one model name photo.php and also create one migration file for the photos table.

Now open create_photos_table.php migration file from database>migrations and replace up() function with following code:

Now, run the migration to create database table using following artisan command:

Step 4: NPM Configuration

Install all Vue dependencies:

Step 5: Add Routes

After this, we need to define routes in “routes/web.php” file. Lets open “routes/web.php” file and add the following routes in it.

routes/web.php

Step 6: Create Controller By Command

Now, lets create a controller named FileUploadController using command given below –

After that, go to app\Http\Controllers and open FileUploadController.php file. Then update the following code into your FileUploadController.php file:

Step 7: Create Vue Component

Next step, go to resources/assets/js/components folder and create a filed called FileUpload.vue.

And update the following code into your FileUpload.vue components file:

Now open resources/assets/js/app.js and include the FileUpload.vue component like this:app.js

Step 8: Register Vue App

In this step, we will create a blade view file to define Vue’s app. Go to resources/views folder and make a file named upload.blade.php. Then update the following code into upload.blade.php as follow:

Step 9: Run Development Server

Now we are ready to run our example so lets start the development server using following artisan command –

Laravel 7 Vue Dependent Dropdown Example

In this Laravel 7 Vue Dependent Dropdown Example tutorial, I’ll show you how to create dependent dropdown with Vue Js in laravel. In this tutorial you will learn to implement dependent dropdown with Vue Js in laravel. In this tutorial we will be creating simple country dependent dropdown to demonstrate dependent dropdown example in laravel.

Laravel 7 Vue Dependent Dropdown Example

  • Step 1: Download Laravel Fresh App
  • Step 2: Add Database Detail
  • Step 3: Create Migration Files
  • Step 4: Create Models
  • Step 5: NPM Configuration
  • Step 6: Add Routes
  • Step 7: Create Controller By Command
  • Step 8: Create Vue Component
  • Step 9: Initialize Vue Components
  • Step 10: Run Development Server

Step 1: Download Laravel Fresh App

First of all we need to create a fresh laravel project, download and install Laravel using the below command

Step 2: Add Database Details

Now, lets create a MySQL database and connect it with laravel application. After creating database we need to set database credential in application’s .env file.

Step 3: Create Migration Files

Now, in this step we will create model and migration file for form. Please run the following command:

Now open create_countries_states_table.php migration file from database>migrations and replace up() function with the following code:

Now, run the migration to create database table using following artisan command:

Step 4: Create Models

Now, in this step we will create model file. Please run the following command:

Step 5: NPM Configuration

Install all Vue dependencies:


To calling Laravel API routes. You need to install vue-axios. So use run the following command on command prompt:


After installing all dependencies run this command:

Step 6: Add Routes

After this, we need to define routes in “routes/web.php” file. Lets open “routes/web.php” file and add the following routes in it.

routes/web.php

 

Step 7: Create Controller By Command

Now, lets create a controller named CountryStateController using command given below –

After that, go to app\Http\Controllers and open CountryStateController.php file. Then update the following code into your CountryStateController.php file:

Step 8: Create Vue Component

Next step, go to resources/assets/js/components folder and create a filed called DropdownComponent.vue. And update the following code into your DropdownComponent.vue. components file:

Now open resources/assets/js/app.js and include the FileUpload.vue component like this:app.js

Step 9: Initialize Vue Components

In this step, navigate to resources/views and create one folder named layouts. Inside this folder create one blade view file named app.blade.php file.

Next, Navigate to resources/views/layouts and open app.blade.php file. Then update the following code into your app.blade.php file as follow:

Step 10: Run Development Server

Now we are ready to run our example so lets start the development server using following artisan command –

Laravel 7 Restrict IP Address From Accessing Website

In this Laravel 7 Restrict IP Address From Accessing Website tutorial, I’ll show you how to restrict an IP address from accessing the website in laravel. In this tutorial you will learn to restrict user to access website using  IP Address in laravel. With this you will be able to restrict user with specified IP address from accessing the website, In this step by step tutorial we will be creating a middleware to restrict user with IP Address in laravel.

Laravel 7 Restrict IP Address From Accessing Website

  • Download Laravel Setup
  • Configure .env file
  • Create a Middleware
  • Register the Middleware

Step 1: Download Laravel Setup

First of all we need to create a fresh laravel project, download and install Laravel using the below command

Step 2: Configure .env file

Now, lets create a MySQL database and connect it with laravel application. After creating database we need to set database credential in application’s .env file.

Step 3: Create a Middleware

Next step, Run the following artisan command to create a middleware named class BlockIpMiddleware:

Now, Go to app/Http/Middleware folder and open BlockIpMiddleware.php file. Then put the following code in BlockIpMiddleware.php file:

Step 4: Register the Middleware

Now, we need to register the middleware, so go to app/Http/ and open Kernel.php file. And register middleware as follow:

Laravel 7 Vue JS Flash Message Example

In this Laravel 7 Vue JS Flash Message Example Tutorial I’ll show you how to create Flash Message with Vue Js in laravel. In this tutorial you will learn to add Flash Message with Vue Js in laravel.

Laravel 7 Vue JS Flash Message Example

  • Step 1: Download Laravel Fresh App
  • Step 2: Add Database Detail
  • Step 3: Create Model And Migration
  • Step 4: NPM Configuration
  • Step 5: Add Routes
  • Step 6: Create Controller By Command
  • Step 7: Create Vue Component
  • Step 8: Register Vue App
  • Step 9: Run Development Server

Step 1: Download Laravel Fresh App

First of all we need to create a fresh laravel project, download and install Laravel using the below command

Step 2: Add Database Details

Now, lets create a MySQL database and connect it with laravel application. After creating database we need to set database credential in application’s .env file.

Step 3: Create Model And Migration

Now, in this step we will create model and migration file for form. Please run the following command:

This command will create one model name post.php and also create one migration file for the posts table. Now open create_postss_table.php migration file from database>migrations and replace up() function with following code:

Now, run the migration to create database table using following artisan command:

Step 4: NPM Configuration

Install all Vue dependencies:

Step 5: Add Routes

After this, we need to define routes in “routes/web.php” file. Lets open “routes/web.php” file and add the following routes in it.

routes/web.php

Step 6: Create Controller By Command

Now, lets create a controller named PostController using command given below –

After that, go to app\Http\Controllers and open PostController.php file. Then update the following code into your PostController.php file:

Step 7: Create Vue Component

Next step, go to resources/assets/js/components folder and create a file called Post.vue.

And update the following code into your Post.vue components file:

Next, create a new components named flash.vue and update the following code into flash.vue file:

Now open resources/assets/js/app.js and include the Post.vue and Flash.vue component as follow:

Step 8: Register Vue App

Now, you need to create a blade view file to define Vue’s app. Go to resources/views folder and make a file named post.blade.php. Then update the below code into post.blade.php file:

Step 9: Run Development Server

Now we are ready to run our example so lets start the development server using following artisan command –

Laravel 7 Vue JS Like Dislike Example

In this Laravel 7 Vue JS Like Dislike Example Tutorial I’ll show you how to implement Like Dislike with Vue Js in laravel. In this tutorial you will learn to create Like Dislike with Vue Js in laravel.

Laravel 7 Vue JS Like Dislike Example

  • Step 1: Download Laravel Fresh App
  • Step 2: Add Database Detail
  • Step 3: Run Make auth Command
  • Step 4: Create Model And Migration
  • Step 5: NPM Configuration
  • Step 6: Add Routes
  • Step 7: Create Controller By Command
  • Step 8: Create Vue Component
  • Step 9: Create Blade Views And Initialize Vue Components
  • Step 10: Run Development Server

Step 1: Download Laravel Fresh App

First of all we need to create a fresh laravel project, download and install Laravel using the below command

Step 2: Add Database Details

Now, lets create a MySQL database and connect it with laravel application. After creating database we need to set database credential in application’s .env file.

Step 3: Run Make auth Command

Step 4: Create Model And Migration

Now, in this step we will create model and migration file for form. Please run the following command:

This command will create one model name post.php and also create one migration file for the posts table. Now open create_postss_table.php migration file from database>migrations and replace up() function with following code:

Now, run the migration to create database table using following artisan command:


Next, Navigate to app/Post.php and update the following code into your Post.php model as follow:

Next, Navigate to database/factories and open PostFactory.php. Then update the following code into it as follow:

and then run the following commad to generate fake data using faker as follow:

Step 5: NPM Configuration

Install all Vue dependencies:

Step 6: Add Routes

After this, we need to define routes in “routes/web.php” file. Lets open “routes/web.php” file and add the following routes in it.

routes/web.php

Step 7: Create Controller By Command

Now, lets create a controller named PostController using command given below –

After that, go to app\Http\Controllers and open PostController.php file. Then update the following code into your PostController.php file:

Step 8: Create Vue Component

Next step, go to resources/assets/js/components folder and create a files called LikeComponent.vue and DisLikeComponent.vue.

Now, update the following code into your LikeComponent.vue components file:

Next, update the following code into DisLikeComponent.vue file as follow:

Now open resources/assets/js/app.js and include the LikeComponent.vue and DisLikeComponent.vue component as follow:

Step 9: Create Blade Views And Initialize Vue Components

In this step, navigate to resources/views and create one folder named layouts. Inside this folder create one blade view file named app.blade.php file.

Next, Navigate to resources/views/layouts and open app.blade.php file. Then update the following code into your app.blade.php file as follow:

Next, Navigate to resources/views/ and create one file name posts.blade.php. Then update the following code into your posts.blade.php file as follow:

Again, Navigate to resources/views/ and create one file name single-post.blade.php. Then update the following code into your single-post.blade.php file as follow:

Step 10: Run Development Server

Now we are ready to run our example so lets start the development server using following artisan command –

Laravel 7 Vue JS Search Filter Example Tutorial

In this Laravel 7 Vue JS Search Filter Example Tutorial I’ll show you how to create search filter with Vue Js in laravel. In this tutorial you will learn to create search filter with Vue Js in laravel.

Laravel 7 Vue JS Search Filter Example Tutorial

  • Step 1: Download Laravel Fresh App
  • Step 2: Add Database Detail
  • Step 3: Run Make auth Command
  • Step 4: Create Model And Migration
  • Step 5: NPM Configuration
  • Step 6: Add Routes
  • Step 7: Create Controller By Command
  • Step 8: Create Vue Component
  • Step 9: Create Blade Views And Initialize Vue Components
  • Step 10: Run Development Server

Step 1: Download Laravel Fresh App

First of all we need to create a fresh laravel project, download and install Laravel using the below command

Step 2: Add Database Details

Now, lets create a MySQL database and connect it with laravel application. After creating database we need to set database credential in application’s .env file.

Step 3: Run Make auth Command

Step 4: Create Model And Migration

Now, in this step we will create model and migration file for form. Please run the following command:

This command will create one model name post.php and also create one migration file for the posts table.

Now open create_posts_table.php migration file from database>migrations and replace up() function with following code:

Now, run the migration to create database table using following artisan command:

Next, Navigate to app/Post.php and update the following code into your Post.php model as follow:

Next, Navigate to database/factories and open PostFactory.php. Then update the following code into it as follow:

and then run the following commad to generate fake data using faker as follow:

Step 5: NPM Configuration

Install all Vue dependencies:

Step 6: Add Routes

After this, we need to define routes in “routes/web.php” file. Lets open “routes/web.php” file and add the following routes in it.

routes/web.php

Step 7: Create Controller By Command

Now, lets create a controller named PostController using command given below –

After that, go to app\Http\Controllers and open PostController.php file. Then update the following code into your PostController.php file:

Step 8: Create Vue Component

Next step, go to resources/assets/js/components folder and create a file called FilterComponent.vue. Now, update the following code into your FilterComponent.vue components file:

Now open resources/assets/js/app.js and include the FilterComponent.vue component as follow:

Step 9: Create Blade Views And Initialize Vue Components

In this step, navigate to resources/views and create one folder named layouts. Inside this folder create one blade view file named app.blade.php file.

Next, Navigate to resources/views/layouts and open app.blade.php file. Then update the following code into your app.blade.php file as follow:

Next, Navigate to resources/views/ and create one file name filter.blade.php. Then update the following code into your filter.blade.php file as follow:

Step 10: Run Development Server

Now we are ready to run our example so lets start the development server using following artisan command –

Laravel 7 Summernote Example Tutorial

In this Laravel 7 Summernote Example Tutorial Tutorial I’ll show you how to use Summernote  in laravel. In this tutorial you will learn to use Summernote in laravel.

Laravel 7 Summernote Example Tutorial

  • Step 1: Install Laravel App
  • Step 2: Add Database Details
  • Step 3: Create Migration and Model File
  • Step 4: Add Routes
  • Step 5: Create Controler
  • Step 6: Create Blade File
  • Step 7: Run Development Server

Step 1: Install Laravel App

First of all we need to create a fresh laravel project, download and install Laravel using the below command

Step 2: Add Database Details

Step 3: Create Migration and Model File

Now, in this step we will create model and migration file for form. Please run the following command:

Next, Navigate to database/migrations and open create_posts_table.php. Then update the following code into create_books_table.php file, as follow:

Now, run the migration to create database table using following artisan command:

After that, Navigate to App directory and open Post.php model file. Then add the following code into Post.php model file, as follow:

app/Post.php

Step 4: Add Routes

After this, we need to define routes in “routes/web.php” file. Lets open “routes/web.php” file and add the following routes in it.

routes/web.php

Step 5: Create Controler

Now, lets create a controller named PostController using command given below –

Then, Navigate to app/http/controllers and open PostController.php file. And update the following code into your PostController.php file, as follow:

Step 6: Create Blade File

In this step, Navigate to resources/views folder. And create 2 blade views that named display.blade.php and create.blade.php the file inside this folder.

Then open create.blade.php file and update the following code into create.blade.php file, as follow:

Now open display.blade.php file and update the following code into your list.blade.php file, as follow:

Step 7: Run Development Server

Now we are ready to run our example so lets start the development server using following artisan command –

Now, open the following URL in browser to see the output –

Laravel 7 Summernote Image Upload Example

In this Laravel 7 Summernote Image Upload Example tutorial, I’ll show you how to use Summernote for Image Upload in laravel. In this tutorial you will learn to upload image using Summernote in laravel.

Laravel 7 Summernote Image Upload Example

  • Step 1: Install Laravel App
  • Step 2: Add Database Details
  • Step 3: Create Migration and Model File
  • Step 4: Add Routes
  • Step 5: Create Controller
  • Step 6: Create Blade File
  • Step 7: Run Development Server

Step 1: Install Laravel App

First of all we need to create a fresh laravel project, download and install Laravel 8 using the below command

Step 2: Add Database Details

Now, lets create a MySQL database and connect it with laravel application. After creating database we need to set database credential in application’s .env file.

Step 3: Create Migration and Model File

Now, in this step we will create model and migration file for form. Please run the following command:

Next, Navigate to database/migrations and open create_posts_table.php. Then update the following code into create_books_table.php file, as follow:

Now, run the migration to create database table using following artisan command:

Now, go to App directory and open Post.php model file. Then add the following code into Post.php model file, as follow:

app/Post.php

Step 4: Add Routes

After this, we need to define routes in “routes/web.php” file. Lets open “routes/web.php” file and add the following routes in it.

routes/web.php

Step 5: Create Controller

Now, lets create a controller named PostController using command given below –

Then, Navigate to app/http/controllers and open PostController.php file. And update the following code into your PostController.php file, as follow:

Step 6: Create Blade File

In this step, Navigate to resources/views folder. And create a blade views that named create.blade.php the file inside this folder. Then open create.blade.php file and update the following code into create.blade.php file, as follow:

Step 7: Run Development Server

Now we are ready to run our example so lets start the development server using following artisan command –

Now, open the following URL in browser to see the output –

Laravel 7 Vue JS Datatables Example Tutorial

In this Laravel 7 Vue JS Datatables Example Tutorial I’ll show you how to use Datatables with Vue Js in laravel. In this tutorial you will learn to use datatables with Vue Js in laravel.

Laravel 7 Vue JS Datatables Example Tutorial

  • Download Laravel Fresh App
  • Add Database Detail
  • Create Model And Migration
  • NPM Configuration
  • Add Routes
  • Create Controller By Command
  • Create Vue Component
  • Create Blade Views And Initialize Vue Components
  • Run Development Server

Step 1: Download Laravel Fresh App

Step 2: Add Database Details

Step 3: Create Model And Migration

Now, in this step we will create model and migration file for form. Please run the following command:

This command will create one model name post.php and also create one migration file for the posts table. Now open create_posts_table.php migration file and put the following code in it:

Now, run the migration to create database table using following artisan command:


Next, Navigate to app/Post.php and update the following code into your Post.php model as follow:

Next, Navigate to database/factories and open PostFactory.php. Then update the following code into it as follow:

now run the following command to generate fake data using faker as follow:

Step 4: NPM Configuration

You need to setup Vue and install Vue dependencies using NPM. So run the following command on command prompt:


Install all Vue dependencies:


Install vuejs-datatable:

Step 5: Add Routes

After this, we need to define routes in “routes/web.php” file. Lets open “routes/web.php” file and add the following routes in it.

routes/web.php

Step 6: Create Controller By Command

Now, lets create a controller named PostController using command given below –

After that, go to app\Http\Controllers and open PostController.php file. Then update the following code into your PostController.php file:

Step 7: Create Vue Component

Next step, go to resources/assets/js/components folder and create a file called DataTableComponent.vue.

Now, update the following code into your DataTableComponent.vue components file:

Now open resources/assets/js/app.js and include the DataTableComponent.vue component as follow:

Step 8: Create Blade Views And Initialize Vue Components

In this step, navigate to resources/views and create one folder named layouts. Inside this folder create one blade view file named app.blade.php file.

Next, Navigate to resources/views/layouts and open app.blade.php file. Then update the following code into your app.blade.php file as follow:

Now, Navigate to resources/views/ and open welocome.blade.php. Then update the following code into your welcome.blade.php file as follow:

Step 9: Run Development Server

Laravel 7/6 Ajax Form Submit Validation Tutorial

In this Laravel 7/6 Ajax Form Submit Validation Tutorial I’ll show you how to submit form using ajax with validation in laravel 7 and 6. In this tutorial you will learn to submit form using ajax and to implement form validation in laravel.

Laravel 7/6 Ajax Form Submit Validation Tutorial

  • Install Laravel Fresh Setup
  • Configure .env file
  • Create One Model and Migration
  • Make Route
  • Generate Controller by Command
  • Create Blade View
  • Start Development Server

Install Laravel Fresh Setup

Configure .env file

Create Model and Migration

Now, in this step we will create model and migration file for form. Please run the following command:

Once above command is executed there will be a migration file created inside database/migrations/ directory. Now, open contact migration file and put the below code here :

Now, run the migration to create database table using following artisan command:

Make Route

After this, we need to define routes in “routes/web.php” file. Lets open “routes/web.php” file and add the following routes in it.

routes/web.php

Generate Controller by Command

Now, lets create a form controller. Create a controller named FormController using command given below –

Now, we will create two methods in controller file. The first is index method to display contact form and second method to store data in the mysql database :

Step 6: Create a blade view

In this step, we will create one blade file name ajax-form.blade.php.

Step 7: Start Development Server

Now we are ready to run our example so lets start the development server using following artisan command –

Now, open the following URL in browser to see the output –

Codeigniter 4 Google Autocomplete Address Search Box Tutorial

In this Codeigniter 4 Google Autocomplete Address Search Box Tutorial, I’ll show you how to integrate Address or location Autocomplete using Google Autocomplete in CodeIgniter 4. In this tutorial you will learn to implement google autocomplete in codeigniter 4.

Google Autocomplete

Google autocomplete widget is used to display suggestions for places, address and location as soon as the user starts typing in the given input box.

Codeigniter 4 Google Autocomplete Address Search Box Tutorial

In this codeigniter 4 google autocomplete tutorial I’ll demonstrate you step by step process to integrate google autocomplete in codeigniter 4 project. Pleasae follow the instructions given below:

  • Create Codeigniter Project
  • CI Error Handling
  • Get Google Maps API Key
  • Connect to Database
  • Create Controller
  • Create Route
  • Add Autocomplete Widget in View
  • Run CI Application

Create Codeigniter Project

First of all we need to create a fresh codeigniter project, download and install codeigniter through composer using following command:

CI Error Handling

In this step we will change display_errors prop’s value to 1 in app/Config/Boot/production.php for error debugging,

app/Config/Boot/production.php

Get Google Maps API Key

Now, we need to get Google API key to enable the communication between client and Google server. Now follow the instructions given below to get Google API Key:

  • Visit Google Cloud Platform.
  • Click on the project dropdown at the top to create the project.
  • Click APIs & Services > Credentials.
  • Now, click on Create Credentials > API key.
  • Copy google API and store in some text file.
  • Now we need to enable few services, so click on Credentials > “Enable APIs and Services”, additionally enable “Maps JavaScript API” and “Places API” services.

 

 

 

Laravel 8 Login with Facebook Account Example

In this Login with facebook in Laravel 8 example tutorial I’ll show you how to integrate facebook login in laravel 8 using socialite package. Integrating Facebook login in Laravel 8 using socialite package is much easier. Allowing users to login with their social media accounts makes registration/login process much easier, it also encourages more users to register for your application.

Laravel 8 Login with Facebook Account Example

In this step by step tutorial, you will learn to integrate Facebook login with your laravel 8 application. Please follow the steps give below:

  • Install Laravel 8 App
  • Configure Database With App
  • Configure Facebook App
  • Install Socialite & Configure
  • Add Field In Table Using Migration
  • Install Jetstream Auth
  • Build Routes
  • Create Facebook Login Controller By Command
  • Integrate FB Login Button In Login Page
  • Start Development Server

Install Laravel 8

First of all we need to create a fresh laravel project, download and install Laravel 8 using the below command

Configure Database In .env file

Now, lets create a MySQL database and connect it with laravel application. After creating database we need to set database credential in application’s .env file.

.env

Configure Facebook App

Step 1:-

Go to Facebook’s developers site https://developers.facebook.com/ and log in with your Facebook account. There in Facebook developers Dashboard you have option to Create App. Lets create a Facebook Login App simply providing App Name and Contact Email.

Step 2:-

After creating the facebook app, go to setting->advanced and set redirect url

Step 3:-

Then, go to Facebook Login -> Settings and scroll down to “Valid OAuth Redirect URL” and set your callback URL

Step 4:-

After creating app, go to Settings -> Basic and get your newly created App ID and App Secret.

Now, go to config directory and open service.php file and add the client id, secret and callback url:

Install Socialite Package via Composer

After Installing ‘socialite’ package, we need to add service provider and alias in config/app.php file as following.

config/app.php

Add Field In Table Using Migration

Now, use the following command to create a migration file to add a column in database table:

Once this command is executed you will find a migration file created under “database/migrations”. lets open migration file and put following code in it –

After successfully add field in database table. Then add fillable property in User.php model, which is found inside app/Models/ directory:

Now, run following command to migrate database schema.

Install Jetstream Auth

In this step, install jetstream laravel auth scaffolding package with livewire. We have provided a complete guide in this Laravel 8 Auth Scaffolding using Jetstream Tutorial.

Build Routes

After this, we need to add following routes in “routes/web.php” file along with a resource route. Lets open “routes/web.php” file and add following route.

routes/web.php

Create Facebook Login Controller

Now, lets create a controller for facebook login. Create a controller named FacebookSocialiteController using command given below –

Once the above command executed, it will create a controller file FacebookSocialiteController.php in app/Http/Controllers/ directory. Open the FacebookSocialiteController.php file and put the following code in it.

app/Http/Controllers/FacebookSocialiteController.php

Integrate FB Login Button In Login Page

Now, we will add facebook login button into login.blade.php file. So, open login.blade.php, which is found inside resources/views/auth/ directory:

Run Development Server

Now we are ready to run our example so lets start the development server using following artisan command –

Now, open the following URL in browser to see the output –