Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Laravel 5.8 crud operation “easy way”

Laravel:-Open source web application framework, written in PHP.

Step 01 : Install Laravel 5.8

composer create-project --prefer-dist laravel/laravel 002 "5.8.*"

“002” is a project name and 5.8 is a version of Laravel.

Step 02 : Update database configuration

A : .env

B : phymyadmin

NOTE:- Same name .env and database.

Step 03 : Make mode with -mcr

 php artisan make:model Today -mcr

Step 04 : Inside todays table (migrations)

Step 05 : Migrate with database

php artisan migrate

Step 06 : Make blade file in resources

Step 07 :make button in laravel dashboard (Welcome.blade.php)

 <a href="{{route('student')}}"><button type="button" btn btn-primary>Student</button></a>

Route for button inside TodayController :- Route::get(‘student’, ‘TodayController@index’)->name(‘student’);

Call blade file from index function(TodayController) :-  return view(‘day.index’);

resources->views->day->layout.blade.php

resources->views-> day->index.blade.php

#Make route for show data , back and submit.

Route::post(‘store’, ‘TodayController@store’)->name(‘store’); //store data

Route::get(‘show’, ‘TodayController@show’)->name(‘show’); // show data

Route::get(‘home’, ‘HomeController@dashboard’)->name(‘dashboard’); // back to dashboard of Laravel

Store data in data base when we hit the submit button

Step 08 : Show data (when we click on show data button)

  1. <a href=”{{route(‘show’)}}”><button type=”button” class=”btn btn-info float-right”>Show Data</button></a> // route in button
  2. Route::get(‘show’, ‘TodayController@show’)->name(‘show’); // Route (web.php)
  3. Inside show function inside TodayController
 public function show(Today $today)
    { 
        $todays =Today::all();
       return view('day.show',compact('todays'));
    }

4. Return show.blade.php With compact (all data)

5. Route in edit and delete button.

 <a href=”{{route(‘edit’,[‘id’=> $today->id])}}”><button type=”button” class=”btn btn-primary”>edit</button></a> // edit data

<a href=”{{route(‘delete’, [‘id’ => $today->id])}}”><button type=”button” class=”btn btn-danger”>Delete</button></a> // delete data

Step 09 : Edit data (edit button)

1.<a href=”{{route(‘edit’,[‘id’=> $today->id])}}”><button type=”button” class=”btn btn-primary”>edit</button></a> // edit data in edit button

2. Route::get(‘edit/{id}’, ‘TodayController@edit)->name(‘edit’); // edit route

3.TodayController->edit function

 public function edit($id)
    {
        Log::info('inside edit function');
        Log::info($id);
        $today =Today::find($id);
        return view('day.edit',compact('today'));
    }

4. return to blade file edit.blade.php

Submit button update function (TodayController)

Step 10 : Delete data

Tagged : / / / / / / /

How to Install/Add-Package in Laravel?

composer require VendorName/PackageName – This command installs a package and any packages that it depends on.

syntaxexample
composer require VendorName/PackageNamecomposer require fzaninotto/faler
composer require VendorName/PackageName:tagcomposer require fzaninotto/faker:dev-master
composer require VendorName/PackageName:versioncomposer require fzaninotto/faker:1.9.0

–dev: Add packages to require-dev.

composer require VendorName/PackageName –dev

https://packagist.org/ This is the website, from where you will get Php packages. This is the package repository of Php. You have to open this site, whatever your requirement is, you can do that package.

If you want a viewer with PDF, then you search by typing PDF. Here the first one wants Dompdf / Dompdf, so I clicked on it. After clicking on it, it will show you what is the version tag. And it will also show how to install it. So to install it, you have to type the command composer require dompdf/dompdf.

Before running this command, you should check that the composor.json file which you have is empty. That is, our project is not dependent on anyone. But now we have the requirement of this project so we will run this command.

Tagged : / / / /

How to set up a new or existing package?

Manually Creating composer.json file

You have to create a composer.joson file and write JSON code yourself with the required properties.

  • composer config –global(-g) – Operate on the global config file located at $COMPOSER_HOME/comfig.json by default. Without this option, this command affects the local composer.json file.
  • composer config –list (-l) __ It shows all the current config variables.
  • composer config setting-key “setting-value” – It sets the config key to the value.
  • composer config –unset – It removes the configuration element named by setting-key.
  • composer config –editor (-e) – Opens the config file (composer.json) in an editor. Use the –global flag to edit the congif (config.json).

Keys:

  • name
  • version
  • type
  • description
  • license
  • homepage
  • keywords
Tagged : / / / /

How do you create a composer.json file by using this command in your project?

We need to create a folder in xampp server. I am going to the local server (C /Drive ) then going to xampp server. Here at htdocs. Then here we will create a project folder that will run on the server.

I will need a text editor I am using Visual studio code you can use notepad, notepad++, sublime text anything.

Then Visual Studio Code has to be opened. After that open folder cmp has to go there location me c/drive/xampp/htdocs/ after that select project folder cmp. Here my project folder has been opened.

Here we create a file index.php and write the code of the PHP in it. And if we need to start the server, then we have to go to Windows Search and search xampp. After that open it and start the Apache server.

After this, we have to run on the tube, for that we have to do a few searches in the search in Windows Manu and open the Run Administrator.

After that, we have to go to my own project of CMD.
Tagged : / /

How to Become a Laravel Developer?

In the world of web development, things are constantly changing. On the other hand, developers have to keep pace with the changing technologies, while businesses look for efficient technologies that help them engage with customers efficiently.

One technology making major waves in the web development field is Laravel. The framework is a hit among web artisans because of its accessibility, power, and other add-on tools to build robust applications. Using the agile development approach, Laravel builds the entire development process without sacrificing functionality.

What is Laravel?

Laravel is a free, open-source PHP-based Web Framework for building High-End Web Applications, following the Model View Controller architectural pattern and based on Symfony. It is created by Taylor Otwell. Laravel is a powerful MVC PHP framework designed for developers who need a simple and elegant toolkit to build full-featured web applications.

What is Laravel Developer?

Laravel Developer is a software professional specializing in the Laravel framework. Now that Laravel technology includes a wide range of tools and libraries that speed up the development cycle, a Laravel developer can focus on design, innovation, functionality, and other things that really matter.

Prerequisities of a Laravel Developer:

  • Bachelor’s Degree/MS degree in Computer Science, Engineering, MIS, or similar relevant field.
  • Proficient in PHP, Javascript, MySQL, AJAX, jQuery, CSS and HTML.
  • Demonstrated attention to detail – in-depth knowledge of object-oriented PHP and Laravel 5 PHP Framework.
  • Experienced with SQL schema design, SOLID principles, REST API design
  • Software testing (PHPUnit, PHPSpec, Behat).
  • Excellent written and oral communication skills.
  • Working on Laravel won’t be easy so he has to be a creative thinker and a problem-solver.

Skills Required to Become an Laravel Developer:

It is fundamental to know PHP: Larvel is a PHP web framework and therefore must be well aware of PHP before placing his hand on the development process. Although it is built on the MVC pattern, its building blocks are PHP functions.

Clarity on the MVC pattern: Larvel is a PHP web framework and therefore must be well aware of PHP before placing his hand on the development process. Although it is built on the MVC pattern, its building blocks are PHP functions.

Why is Laravel the Best PHP Framework?

Because of the dire need for structured development methodologies. Laravel is a PHP framework that has become the go-to solution for developers around the world. It hosts a large ecosystem that allows for instant hosting and system deployment.

In the corporate space, Laravel web development fundamentals have been extensively used to build websites that are capable of running behind complex algorithms and handling multiple visitors at once.

Here are the some few reasons:

  • Security: One of the biggest headaches for programmers is building secure websites and apps. Laravel web development uniquely provides developers with a secure way to maintain the security of their apps.
  • MVC Support: Another major reason why Laravel is beloved among developers is that it supports MVC architectures like Symfony which helps in establishing clarity between logic and presentation. As a result, the app is able to perform better and allows for better documentation.
  • Object-Oriented Libraries: Larvel Framework provides an object-oriented library and comes with an array of pre-installed versions of which are not found in other PHP frameworks.
  • Database Migration: Data between development between the machines is a major pain point for the synchronization programmers. After long working hours and countless changes in our database, these changes can be very hard to save your database. But with Laravel, database migration is very simple, you store these changes, migration, and seeds.

What does a Laravel Developer do?

The world of software technology has given rise to a community of developers who specialize in various technologies.

A Laravel developer is like any other software developer. But, one thing that sets them apart is their special affinity for the Laravel framework using the PHP programming language. Larvel developers make it possible to create highly functional web applications that enhance the user experience.

Roles and Responsibility of Laravel Developer:

  • Building and maintaining modern web applications using standard web development tools
  • Writing clean and secure modular codes that have undergone strict testing and evaluation
  • Checking the validity and consistency of HTML, CSS, and JavaScript on different platforms
  • Debugging and resolving technical issues
  • Maintaining and designing databases
  • Performing back-end and User Interface (UI) tests to enhance the functionality of an application
  • Collaborating with other developers (front-end, back-end, mobile app, etc.) and project managers to move the Software projects faster
  • Documenting the task progress, architecture, and development process

The current PHP version is one of the most popular and desirable frameworks for companies that want to hire a Laravel developer, so if you’re well versed with the current version, your fellow developers will have your say. PHP includes over-the-top benefits and many other features that every software developer dreams of. It has libraries and modules which makes dynamic development a snap, plus saves development cost.

Features of Laravel:

The Future Scope of Laravel Developers:

Before saying anything about the future, I would like to mention here some MNCs which are using PHP today. Google, Yahoo, Rediff, Facebook, Intel, Digg, Flickr, Zynga, Borland, eBay, Nokia, Oracle, etc. I am telling you only one thing that there are a lot of small and popular online web applications based on PHP which is running online and they are all managed and addons by PHP developers. This means you have lots of opportunities to work with your dream companies.

Some of the most frequent designations include Laravel Trainee, Programmer, Web Developer, Web Designer, Software Developer. So, you see the future is bright!

To start with Laravel, check out the DevOpsSchool course. You’ll learn basic structures and techniques and dive into advanced Laravel concepts such as Views & Blade Templating Engine, Working with Routes, Handling Requests & Responses, Using Controllers and Models. You’ll even also join our Online and Classroom Programs.

Tagged : / / /

What is composer.JSON? How do I use it?

A file is generated from the composer tool. Which is the main file of the whole project which we call the composer file. The extension file is composer.json. It is the main composer.json that defines your project requirements.

How to setup a new or existing package

You can also say how to create a composer.json file in a Project to make it a package.

  • Ussing composer init Command
  • Manually Creating composer.json file

Ussing composer init Command

composer init – It is used to set up a new or existing package. The init command creates a basic composer.json file in the current directory.
Every project is a package.
As soon as you a composer.json in a directory, that directory is a package.

composer.json

Package name – in order to make that package installable you need to give it a name. It consists of vendor name and project name, separated by/. The name can contain any character, including white spaces, names are case insensitive, the convention is all lowercase and dashes for word separation. It is required for published packages(libraries).

Syntax:- vendorname/packagename

Ex:- devopsschool/dev

Description- A short description of the package. Usually, this is one line long. It is required for published packages(libraries).

Authors – The authors of the package. This is an array of objects.

Each author object can have the following properties:

  • name: The author’s name. Usually their real name.
  • email: The author’s email aaddress.
  • homepage: An URL to the author’s website.
  • role: The author’s role in the prject (e.g. developer or translator)

Minimum Stability – Composer accepts these flags as minimum-stability settings. The defualt setting for minimun-stability if not provided is assumed to be stable, but you sould define any of the flags down the hierarchy.

  • stable (most stable)
  • re
  • beta
  • alpha
  • dev (least stable)

Package Type – Package types are used for custom installation logic. If you have a package that needs some special logic, you can define a custom type. It default to library.

  • Library
  • Project
  • Metaapackage
  • Composer-plugin

License – The license of the package. This can be either a string or an array of strings.

Ex:- MIT

Tagged : / / / /

Introduction to Laravel

What is Laravel?

Laravel is a web framework built on PHP. That is, the code that has been done has been coded in PHP. You can use it to create High-End Web Applications, you can create the very best web application using Laravel in it. Laravel follows the architectural pattern of MVC (Model View Controller). Laravel was created by Taylor Otwell.

Advantages of Laravel?

  • Open Source
  • Collection of tools
  • Save Time
  • Improve Productiity
  • Robust and Easy
  • Security of the Application
  • Authentication
  • Routing
  • Templating

Requirements for Learning Laravel

Do You Know

  • HTML
  • CSS
  • JavaScript
  • SQL
  • PHP OOP
  • MVC
  • Composer

Laravel Requirements

  • PHP 7.2.0 or Higher
  • XAMPP (Apache + MariaDB + PHP + Perl)
  • WAMP/LAMP/MAMP
  • Composer
  • Text/Code Editor- Notepad++, VS Code, ATOM, Brackets
  • Web Browser- Google Chrome, Mozilla Firefox, Edge
Tagged : / / / / /

How to Install Composer in Laravel?

Composer requires PHP 8.0+ to run

  • Download Composer exe from official website then install it
  • Use command line installation

-May need to set Path or use php composer.phar init

Go to the windows search menu and type cmd

Open Command Prompt then right click and go to Run as administrator

Then show you screen c:\Windows\system32>
and then type composer -V and press enter bottom.
If your composer is already installed then your computer screen will show the composer version. And if not already installed it will show – Composer is not recognized unknown internal and external commands, compatible programs, and batch files.

How to Update Composer

There is some new update in composer, so if you want to update it then you have to run command for it:

composer self-update

How to Roll Back Composer Update

If that update starts happening, then you can roll back that update and go back to the old versions. For which you have to run the command:

composer self-update –rollback

Tagged : / / / /

How to use Composer in Laravel?

What is Composer?

Composer is a tool dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) than for you. Composer is not a package manager in the same a Yum or Apt are. Yes, it deals with “packages” or libraries, but it manages them on a per-project basis, installing them in a directory (e.g. vendor) inside your project. By default, it does not install anything globally. Thus, it is a dependency manager. It does however support a “global” project for convenience via the global command.

Why use Composer?

  • You have a project that depend on a number of libraries.
  • Some of thoes libraries epen on other libraries.
  • Enable you to declare the libraries you depend on.
  • Find out which versions of which packeges can and need to be installed, and installs them.

You have a project that depends on several libraries. The libraries that I used in my project to create PDF are also supported by other libraries. It gives you the urgency to declare those libraries that you are on these libraries as it will manage them all for you. It will find out which packages are required for the project we have. Which version of the package is required and will install it for you.

Tagged : / / / /

Complete Referance of Blade in Laravel

What is Blade?

Blade is the simple, yet powerful templating engine that is included with Laravel. Unlike some PHP templating engines, Blade does not restrict you from using plain PHP code in your templates.

Blade template files use the .blade.php file extension and are typically stored in the resources/views directory

Blade Template

Displaying Data – You may display data that is passed to your Blade views by wrapping the variable in curly braces.

Blade’s {{ }} echo statements are automatically sent through PHP’s htmlspecialchars function to prevent XSS attacks.

Example:- {{$name}}

Calling Function – You may also echo the results of any PHP function by wrapping the function name in curly braces.

Example:- {{ time( ) }}

Note – You can put any PHP code you wish inside of a Blade echo statement.

Comment

Blade also allows you to define comments in your views. However, unlike HTML comments, Blade comments are not included in the HTML returned by your application.

{{– This comment will not be present in the rendered HTML –}}

Conditional Directives

If Directive

If.. Else.. Directive

If… elseif… else… Directive

Empty Directive

Authentication Directives

Auth Directive

Guest Directive

Tagged : /