Category Archives: Laravel

Laravel Tutorials

Laravel str camel() function Example

Laravel str camel() function Example

In this article, I’ll show you how to use laravel str camel() function with example. We will show example of camel function in laravel.The Str::camel method is use to convert the given string to camelCase.

Example:-

Output:-

Laravel 8 Install in Ubuntu Example

In this article, we will learn how to install Laravel 8 on Ubuntu 16.04 and 18.04. If we want to install laravel framework then are required to have LAMP for our system. First we need to install LAMP in our system. We need to install apache server MySQL and PHP.

Step 1: Install Composer
Step 2: Install Laravel 8
Step 3: Configure Apache2
Step 4: Enable Laravel virtual host site and Apache2 Rewrite Module
Step 5: Restart Apache2 server

Install Composer

Use the following command to download the composer:

Now we move the composer.phar file into the bin folder and set the permission for all users.

Install Laravel 8

Now this step, I will move on root directory “/var/www/html” and .download and install fresh laravel.

After installing laravel 8, we need to set permission for the new directory.Use the following command to set permission:

Configure Apache2

Now, we will configure the Apache2 site configuration file for Laravel. Run the below command to create a new configuration file for larvel configuration laravel.conf

After creating configuration file, put the below code in this file and save it.

Enable Laravel virtual host site and Apache2 Rewrite Module

After configuring Apache2 server, we have to enable laravel virtual host site and Apache2 rewrite module. Use following command to enable it.

Restart Apache2 server

Now, we need to restart Apache2 server. Use the following command to restart Apache2 server.

Run Our Laravel Application

Now, open the following Url in the browser to test our example.

Laravel 8 Barcode Generator Example Tutorial

In this tutorial, we will learn how to generate barcode in laravel 8 application. I’ll guide you through step by step for generation of barcode in a laravel 8 application. We will be using ‘milon/barcode’ package for generating barcode in laravel 8. In this tutorial, we will guide you step by step to generate bar code in your laravel 8.

Contents:-

  • Install Laravel 8
  • Setup Database Credentials
  • Install milon/barcode Package
  • Configure Barcode Generator Package
  • Define Route
  • Creating BarCode Controller
  • Create Blade View
  • Start Development Server

Install Laravel 8 Application

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

Database Configuration

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.

Installing Barcode Generator Package

We will be using “milon/barcode” Package” for generating barcode in laravel 8 application. In this step we will be installing “milon/barcode” via following composer command, lets open your terminal and switch to the project directory and enter the following command –

Configure Barcode Generator Package

Create Routes

After this, we need to add following two routes in “routes/web.php” to display barcode. Lets open “routes/web.php” file and add following route.

routes/web.php

Creating BarCode Controller

Now, lets create a controller for barcode generation. Create a controller named BarcodeController using command given below –

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

app/Http/Controllers/BarcodeController.php

Create Blade View

In this step, we will create view/blade file to display barcode. Lets create a “barcode.blade.php” file in “resources/views/” directory and put the following code in it.

resources/views/barcode.blade.php

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 –

http://localhost:8000/barcode

Laravel 8 Install React Example

In this article, we will learn how to install react in laravel 8 application. We will implement a laravel 8 react example application. In this tutorial we will understand how to install and setup laravel 8 with react js. In this example we will also install react with laravel and also laravel 8 react auth using laravel ui.

Install Laravel 8

First, open Terminal and run the following command to create a fresh Laravel project:

Install Laravel UI

Install Laravel UI package for starting with Laravel 8 with React JS. So if you want to start with Laravel 8 with React, run the below command:

Install React

Install React with Auth

now, you need to install npm and run it. so let’s run bellow command:

Install Required Packages

I assume that you already have the Node and NPM installed on your development machine. If not, then use the following instruction:

To Install NPM, Run the following command:

Now run NPM, use the following command:

How to install Bootstrap 4 in Laravel 8

How to install Bootstrap 4 in Laravel 8

In this article, you will learn you how to install bootstrap 4 in laravel 8, I’ll show you how install bootstrap 4 in laravel 8. In this step by step laravel 8 install bootstrap 4 tutorial. you will understand to install bootstrap 4 in laravel 8.

Install Laravel Project

Install Laravel/UI

Now, switch the laravel project directory and run the following composer command to install laravel/ui package. Laravel UI is an official library that offers selective or predefined UI components. The laravel/ui package comes with the login and registration scaffolding for React, Vue, jQuery, and Bootstrap layouts.

Run the following composer command to install Laravel/UI.

Install Bootstrap 4 In laravel 8

Run following artisan command to install Bootstrap in your Laravel project.

Install Bootstrap Auth Scaffolding

Use the following artisan command to Install the auth scaffoldings with Bootstrap.

Now, you have successfully installed bootstrap in your laravel 8 project, you can see your resource directory js folder.

Install Bootstrap Packages

Now, you need to install the bootstrap package and the related frontend dependencies such as jquery from npm using the following command:

Run NPM

Now, run the below command for asset compilation.

The above command compiles CSS and JavaScript files from resources/js and resources/sass folder to the public folder.

How to use Bootstrap in Laravel Blade Template

Now, you can use the bootstrap js and CSS in laravel blade template as following:

How To Install Vue Js in Laravel 8

In this article, we will learn how to install vue js in laravel 8 application. We will implement a laravel 8 vue js example application. In this tutorial we will understand how to install and setup laravel 8 with vue js. In this example we will also install vue js with laravel and also laravel 8 vue auth using laravel ui.

Install Laravel 8

First, open Terminal and run the following command to create a fresh Laravel project:

Install Laravel UI

Install Laravel UI package for starting with Laravel 8 with Vue JS. So if you want to start with Laravel 8 with Vue, run the below command:

Install Vue

Install Vue with Auth

now, you need to install npm and run it. so let’s run bellow command:

Install Required Packages

I assume that you already have the Node and NPM installed on your development machine. If not, then use the following instruction:

To Install NPM, Run the following command:

Now run NPM, use the following command:

Laravel Str::random() function Example

In this article, I’ll show you how to use laravel Str::random function with example. We will show example of laravel Str::random function in laravel. In this tutorial, we will learn to generate a random string of the specify length in laravel.

Laravel Str::random method

The Str::random method generates a random string of the specified length. This function is mainly used to generate random string.

Example:-

Laravel str is() function Example

In this article, I’ll show you how to use laravel Str::is function with example. We will show example of laravel Str::is function in laravel. In this tutorial, we will check match test string with specified pattern.

Laravel Str::is method

The Str::is method is sued to determines if a given string matches with given pattern. Asterisks may be used to indicate wildcard.

Example:-

Output:-

 

Laravel str isAscii() function Example

In this article, I’ll show you how to use laravel isAscii() function with example. We will show example of laravel isAscii() function in laravel. In this tutorial, we will check if a test string is valid 7 bit ASCII.

Laravel isAscii() function

The Str::isAscii method to determines if a given string is 7 bit ASCII.

Example:-

Output:-

Laravel str replaceLast() function Example

In this article, I’ll show you how to use laravel Str::replaceLast function with example. We will show example of laravel Str::replaceLast function in laravel. In this tutorial, we will create example to demonstrate the use of Str::replaceLast function.

Laravel Str::replaceLast method

The Str::replaceLast method replaces the last occurrence of a given value in a string.

Example:-

Output:-

 

Laravel str slug() helper function Example

In this article, I’ll show you how to generate seo friendly url slug using laravel Str::slug method. We will show example of laravel str_slug helper function in laravel. In this tutorial, generate seo friendly url slug with provided string using laravel Str::slug method.

Laravel Generate URL Slug Using Str::slug method

The Str::is method is used to generate seo friendly URL “slug” with the provided string. Example:-

Output:-

SEO Friendly URL Slug Using str_slug helper function

You can also use the laravel Str::slug method as helper function called as str_slug(). When you want to use helpers functions then you need to install a composer package with following artisan command:

Example:-

Output:-

Laravel str e() function Example

In this article, I’ll show you how to use laravel str e() function with example. We will show example of laravel str e() function in laravel. In this tutorial, we will check if a test string is valid 7 bit ASCII.

Laravel Str::e method

The Str::e method determines if a given string is 7 bit ASCII.

Example:-