How to be professional on Laravel

Laravel is a PHP framework that is used to develop very lightweight applications and web-based systems.

It has many helpful resources to debug errors on or offline.

It is the most frequently updated framework in the world of development technology.

Why Laravel?

Laravel has easy access to and control resources of the framework and easy to control any resources in every file.

It uses very easy clean blade templates.

It has its own authentication plugins or packages simple to configure.

How to Install and Configure Laravel?

Installation of Laravel is a very easy step and simple way by using cmd or terminal

The basic requirement to install Laravel

  • latest PHP version
  • Local Server
  • XAMPP or WAMP
  • Code Editors (Visual Studio Code, sublime, phpstrom, atom code editor, notepad++, and others)
  • Install Composer on your machine

What is Composer?

Composer is a package manager setup that is used to download any plugs and vendors for our setups.

Generally, the composer is a package manager software.

How to Install Composer?

We can install Composer in simple and easy ways.

Download the setup from the composer portal public website and install it by clicking next and next, finish it finally. if you want visit this video full installation of composers. How to install composer

After installing Composer on your computer we can check by typing the below code.composer

If you get the above picture your installation process is correct you can proceed with it.

To install Laravel you refer to Laravel documentation of free sources.

To Install Laravel we must Follow the following Steps

Step 1: You must check your computer or server has php latest and updated version.

Step 2: Open cmd or terminal by running as administrators.

To install the Laravel PHP framework we have two options.

Options 1: Install Laravel as global and access to everywhere in your folders and directory

Type or copy the below code on your terminals.

composer global require "laravel/installer"

After globally installing Laravel we must configure and export php to global files by typing the following commands.

export PATH="$PATH:$HOME/.config/composer/vendor/bin"

Create a New project of Laravel by using the keyword new and the project name simply.

laravel new EMS

The above code has three words. The first “Laravel” package name contains all files and vendors in setups. the second name new is a keyword that is used to create new Laravel projects. the 3rd word is the project name “EMS” which means the abbreviation of Employee Management System.

After Creating a new Project change your director to your project name by typing the following commands.

cd EMS 

The command is used to change the directory of your folders.

To Run your product use the below commands

php artisan serve

PHP artisan serve is a command that is used to run your project on development servers.

Remember: You can use Laravel as a back-end Server if you want.

Option 2: Install laravel inside your directory only

To install Laravel on your project directory, this type of installation is also called local installation of laravel php frameworks.

To install Laravel setup we can use the following commands

Open your cmd or terminal and type the below codes.

composer create-project --prefer-dist laravel/laravel ems

The above code creates a new folder name ems with different folders and files. All the folders and files are called laravel folders and file structures.

The above image shows the fully installed laravel php framework on your computer.

In the next Step we must change our directory to the installed project namescd ems

Change your project directory to your project name.

After changing your directory to your project name run your project on local servers by typing

php artisan serve

PHP artisan service is used to run all packages of setups and render them on the web browsers.

Our laravel project is running successfully on port 8000.

To get on your web browser type 127.0.0.1:8000 and then get basic and freshly installed laravel setups

The above picture shows the fresh installers of laravel frameworks.

Notes: We can use Laravel as PWA(progressive Web App).

What is Route and How to Configure Routes on Laravels?

The route is the compass of our system.

The route is generally the gateway of our system.

Routes are the collection of our system configuration and URLs of the system.

To get lists of routes type these commands

php artisan route:list

The above image shows the list of default installed laravel routes lists.

How to Create Route in Laravel?

To create a route in laravel we must follow the following steps clearly.

Step 1. Open your project with the code Editors you want. For these tutorials, I used Visual Studio code. To open our project with Visual Studio code simply change your directory to your project name and type cmd ems and code.

Step 2: Select routes folder

open web.php on your code editors working areas.

Let’s view some details about these route structures

Routes folders have four basic files those are api.php, channels.php, console.php, and web.php.

api.php is used to set the API setups, and restful services for our applications. When we set api.php our application acts as a server not as a front-end to allow the back-end.

web.php is used to set routes for our web applications by calling our controllers and our required resources.

Route:: -> it is the package name that is used to create Route resources.

Route::get, put, delete, post, and many others.Route::get("/",[ControllerName::class,'index'])->name('list');

for all posts, put, and delete are the same.

How to Create a Controller On Laravel?

The controller is the moderator of the system, it is the intermediate of models and views of the system and change.

To create a controller use the following command

php artisan make:controller EmployeeController

To create a controller with resources we can use the following command

php artisan make:controller EmployeeController -r

How to Create a Model on Laravel?

Model is where the business logic takes place area. We can write all business logic on models, we can write and query in models.

The general model is where we type active recording of the tables.

To create a model follow the following steps.

php artisan make:mode Employees

We can also create models with migrations

php artisan make:model employees -m

-m is used to create migrations

Summary

In general, laravel has many features, a lightweight setup, and easy-to-customize and manage source codes.

Laravel used to develop very complex and large projects in simple and easy ways.

I hope this post helps you with some basic concepts on Laravels.

Author: bbnadmin

3 thoughts on “How to be professional on Laravel

  1. Bayyee gariidhaa. Haaluma kanaan ittii nu fufii. Please yoo siif danda’ame content laravel qabate jiru hundaa isaa cover osoo nuuf goote bayyee nattii tola.
    Galatomii!!

Leave a Reply

Your email address will not be published. Required fields are marked *