SlideShare a Scribd company logo
WHAT IS LARAVEL ?
Presented By
Dyuti Islam
151-15-5435
Section:B
CONTENTS …
 What is Laravel ?
 Install Laravel 5 with Composer
 Files structure
 What is artisan and how does it save us time?
 Routing and route types
 What is Middleware and how to use it?
 What is Blade ?
 Database and Eloquent ORM
 CRUD with validation and database
connection (practical task)
 Best practices when coding in Laravel
LERAVEL
 Laravel is MVC PHP framework created by Taylor Otwell in 2011
 Free open-source license with many contributors worldwide
 One of the best frameworks together with Symfony, CodeIgniter,
Yii
 Has powerful features, saving us time
 Uses Symfony packages
 Lets see some statistics
GOOGLE TRENDS (2012 – 2017)
PHP FRAMEWORK POPULARITY AT WORK – SITEPOINT 2015
FEATURES
 Eloquent ORM (object-relational mapping) – implements ActiveRecord
 Query builder – helps you to build secured SQL queries
 Restful controllers – provides a way for separating the different HTTP requests (GET,
POST, DELETE, etc.)
 Blade template engine – combines templates with a data model to produce views
 Migrations – version control system for database, update your database easier
 Database seeding – provides a way to populate database tables with test data used for
testing
 Pagination – easy to use advanced pagination functionalities
 Forms security – provides CSRF token middleware, protecting all the forms
MUST HAVE PACKAGES
 Laravel debugbar - https://github.com/barryvdh/laravel-debugbar
Great for debugging on local environment. Shows all the views, requests,
exceptions loaded for the current page.
 LaravelCollective – Forms & HTML -
https://laravelcollective.com/docs/master/html
Perfect for generating forms, inputs, script tags and style tags
 Laravel IDE Helper - https://github.com/barryvdh/laravel-ide-helper
The package helps your IDE with autocomplete and autosuggest methods, views,
functions and more.
LET’S INSTALL LARAVEL
 Laravel uses Composer to manage its dependencies
 Composer is dependency management tool for PHP,
like a library full of books
 NOT like Yum or apt
 Per project tool (vendor folder), not per system
 Install by using the command:
composer create-project --prefer-dist laravel/laravel
laravel-softuni
THE STRUCTURE
app/Http folder contains the Controllers,
Middlewares and Kernel file
All the models should be located in
app/Models folder
All the config files are located in app/config
folder
The service providers that are bootstrapping
functions in our app are located in
app/Providers folder
ARTISAN !
 Artisan is command-line interface for
Laravel
 Commands that are saving time
 Generating files with artisan is
recommended
 Run php artisan list in the console
MIDDLEWARE
 The middleware is mechanism for
filtering the HTTP requests
 Laravel includes several middlewares
– Authentication, CSRF Protection
 The auth middleware checks if the
user visting the page is authenticated
through session cookie
 The CSRF token protection
middleware protects your application
from cross-site request forgery
attacks by adding token key for each
generated form
 Let’s create middleware
BLADE
 Blade is the powerful template engine provided by
Laravel
 All the code inside blade file is compiled to static html file
 Supports plain PHP
 Saves time
 Better components mobility, extend and include partials
 Let’s take a look at few examples
ELOQUENT & DATABASE
 The Eloquent ORM (Object-relational mapping) provides simple ActiveRecord
implementation for working with the database
$article = new Article();
$article->title = ‘Article title’;
$article->description =
‘Description’;
$article->save();
INSERT INTO `article` (`title`, `description`) VALUES (‘Article title’, ‘Description’);
 Each table has its own “Model”. You can use the model to read, insert, update or delete
row from the specific table
 Let’s check one model
PRACTICAL TASK
We will play with Laravel and create CRUD for recipes (Create, Read, Update,
Delete).
The recipe will have the following columns / fields :
• Id – primary key – not null
• Title – varchar – 255 length – not null
• Description – text – nullable
• Status – enum [ active / inactive ] – not null – defaults to active
• Created At – datetime – not null
• Updated At – datetime – not null
BEST PRACTICES IN LARAVEL
NEVER write queries or model logic inside the controller! The
controller job is to communicate with the model and pass data to
the view.
VIEWS MOBILITY
Extend and include partials. For example share the
same form fields on 2 pages – add and edit
FORMS SECURITY
Always use the CSRF token protection that Laravel provides in forms you create, the
hackers will not be able to spam your forms and database
BIG QUERY
• Avoid the big query unless you
really have to do it. The big
query is hard to debug and
understand.
• You can merge the small
queries into one to save the
CPU time on server, but
sometimes the query becomes
way too big.
DON’T FORGET THE PHPDOC
Don’t forget to write comments for each method or complicated logic. The PHPDoc
comments are helping the IDE to autosuggest easier and the developers to understand
the piece of code
THANK YOU! QUESTIONS ?

More Related Content

What's hot

Laravel ppt
Laravel pptLaravel ppt
Laravel ppt
Mayank Panchal
 
Laravel - The PHP Framework for Web Artisans
Laravel - The PHP Framework for Web ArtisansLaravel - The PHP Framework for Web Artisans
Laravel - The PHP Framework for Web Artisans
Windzoon Technologies
 
Introduction to laravel framework
Introduction to laravel frameworkIntroduction to laravel framework
Introduction to laravel framework
Ahmad Fatoni
 
Why Laravel?
Why Laravel?Why Laravel?
Why Laravel?
Jonathan Goode
 
Laravel presentation
Laravel presentationLaravel presentation
Laravel presentation
Toufiq Mahmud
 
Laravel tutorial
Laravel tutorialLaravel tutorial
Laravel tutorial
Broker IG
 
Laravel Introduction
Laravel IntroductionLaravel Introduction
Laravel Introduction
Ahmad Shah Hafizan Hamidin
 
Projects In Laravel : Learn Laravel Building 10 Projects
Projects In Laravel : Learn Laravel Building 10 ProjectsProjects In Laravel : Learn Laravel Building 10 Projects
Projects In Laravel : Learn Laravel Building 10 Projects
Sam Dias
 
Laravel 101
Laravel 101Laravel 101
Laravel 101
Commit University
 
Spring Framework - MVC
Spring Framework - MVCSpring Framework - MVC
Spring Framework - MVC
Dzmitry Naskou
 
Spring Boot
Spring BootSpring Boot
Spring Boot
Jiayun Zhou
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot Introduction
Jeevesh Pandey
 
Spring MVC Framework
Spring MVC FrameworkSpring MVC Framework
Spring MVC Framework
Hùng Nguyễn Huy
 
Lecture 2_ Intro to laravel.pptx
Lecture 2_ Intro to laravel.pptxLecture 2_ Intro to laravel.pptx
Lecture 2_ Intro to laravel.pptx
SaziaRahman
 
Introduction to spring boot
Introduction to spring bootIntroduction to spring boot
Introduction to spring boot
Santosh Kumar Kar
 
Php and MySQL
Php and MySQLPhp and MySQL
Php and MySQL
Tiji Thomas
 
PHP-MySQL Database Connectivity Using XAMPP Server
PHP-MySQL Database Connectivity Using XAMPP ServerPHP-MySQL Database Connectivity Using XAMPP Server
PHP-MySQL Database Connectivity Using XAMPP Server
Rajiv Bhatia
 
How To be a Backend developer
How To be a Backend developer    How To be a Backend developer
How To be a Backend developer
Ramy Hakam
 

What's hot (20)

Laravel ppt
Laravel pptLaravel ppt
Laravel ppt
 
Laravel - The PHP Framework for Web Artisans
Laravel - The PHP Framework for Web ArtisansLaravel - The PHP Framework for Web Artisans
Laravel - The PHP Framework for Web Artisans
 
Introduction to laravel framework
Introduction to laravel frameworkIntroduction to laravel framework
Introduction to laravel framework
 
Why Laravel?
Why Laravel?Why Laravel?
Why Laravel?
 
Laravel presentation
Laravel presentationLaravel presentation
Laravel presentation
 
Laravel tutorial
Laravel tutorialLaravel tutorial
Laravel tutorial
 
Laravel Introduction
Laravel IntroductionLaravel Introduction
Laravel Introduction
 
Projects In Laravel : Learn Laravel Building 10 Projects
Projects In Laravel : Learn Laravel Building 10 ProjectsProjects In Laravel : Learn Laravel Building 10 Projects
Projects In Laravel : Learn Laravel Building 10 Projects
 
Laravel 101
Laravel 101Laravel 101
Laravel 101
 
Spring Framework - MVC
Spring Framework - MVCSpring Framework - MVC
Spring Framework - MVC
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot Introduction
 
Php introduction
Php introductionPhp introduction
Php introduction
 
Spring MVC Framework
Spring MVC FrameworkSpring MVC Framework
Spring MVC Framework
 
Lecture 2_ Intro to laravel.pptx
Lecture 2_ Intro to laravel.pptxLecture 2_ Intro to laravel.pptx
Lecture 2_ Intro to laravel.pptx
 
Introduction to spring boot
Introduction to spring bootIntroduction to spring boot
Introduction to spring boot
 
Php and MySQL
Php and MySQLPhp and MySQL
Php and MySQL
 
PHP-MySQL Database Connectivity Using XAMPP Server
PHP-MySQL Database Connectivity Using XAMPP ServerPHP-MySQL Database Connectivity Using XAMPP Server
PHP-MySQL Database Connectivity Using XAMPP Server
 
Xampp Ppt
Xampp PptXampp Ppt
Xampp Ppt
 
How To be a Backend developer
How To be a Backend developer    How To be a Backend developer
How To be a Backend developer
 

Similar to Laravel

What’s New in Laravel 8 for a Laravel Development Company?
What’s New in Laravel 8 for a Laravel Development Company?What’s New in Laravel 8 for a Laravel Development Company?
What’s New in Laravel 8 for a Laravel Development Company?
Inexture Solutions
 
Latest Laravel Practice 2023 Experts Guidance.pdf
Latest Laravel Practice 2023 Experts Guidance.pdfLatest Laravel Practice 2023 Experts Guidance.pdf
Latest Laravel Practice 2023 Experts Guidance.pdf
Sufalam Technologies
 
Web presentation
Web presentationWeb presentation
Web presentation
Solaiman Hossain Tuhin
 
Laravel: Unleashing the power of PHP
Laravel: Unleashing the power  of PHPLaravel: Unleashing the power  of PHP
Laravel: Unleashing the power of PHP
Cetpa Infotech
 
Getting started with laravel
Getting started with laravelGetting started with laravel
Getting started with laravel
Advance Idea Infotech
 
Laravel Web Development: A Comprehensive Guide
Laravel Web Development: A Comprehensive GuideLaravel Web Development: A Comprehensive Guide
Laravel Web Development: A Comprehensive Guide
deep9753ak
 
Laravel (8) php_framework_handbook__start_from_zer_18604872_(z-lib.org)
Laravel (8) php_framework_handbook__start_from_zer_18604872_(z-lib.org)Laravel (8) php_framework_handbook__start_from_zer_18604872_(z-lib.org)
Laravel (8) php_framework_handbook__start_from_zer_18604872_(z-lib.org)
ssuser337865
 
Laravel - A Trending PHP Framework
Laravel - A Trending PHP FrameworkLaravel - A Trending PHP Framework
Laravel - A Trending PHP Framework
ijtsrd
 
Laravel 4 presentation
Laravel 4 presentationLaravel 4 presentation
Laravel 4 presentation
Abu Saleh Muhammad Shaon
 
Who Should Consider Using Laravel for Web Development?
Who Should Consider Using Laravel for Web Development?Who Should Consider Using Laravel for Web Development?
Who Should Consider Using Laravel for Web Development?
Acquaint Softtech Private Limited
 
Laravel Presentation
Laravel PresentationLaravel Presentation
Laravel Presentation
REZAUL KARIM REFATH
 
laravel-interview-questions.pdf
laravel-interview-questions.pdflaravel-interview-questions.pdf
laravel-interview-questions.pdf
AnuragMourya8
 
Why is Laravel the best framework for startups?
Why is Laravel the best framework for startups?Why is Laravel the best framework for startups?
Why is Laravel the best framework for startups?
Sterling Technolabs
 
What makes Laravel the optimal framework for your project.pdf
What makes Laravel the optimal framework for your project.pdfWhat makes Laravel the optimal framework for your project.pdf
What makes Laravel the optimal framework for your project.pdf
CubetTechnoLabs1
 
Lecture11_LaravelGetStarted_SPring2023.pdf
Lecture11_LaravelGetStarted_SPring2023.pdfLecture11_LaravelGetStarted_SPring2023.pdf
Lecture11_LaravelGetStarted_SPring2023.pdf
ShaimaaMohamedGalal
 
Article laravel 8
Article laravel 8Article laravel 8
Article laravel 8
hadeedulhassan
 
Unleashing the Power of Laravel A Journey to Modern Web Development | CETPA I...
Unleashing the Power of Laravel A Journey to Modern Web Development | CETPA I...Unleashing the Power of Laravel A Journey to Modern Web Development | CETPA I...
Unleashing the Power of Laravel A Journey to Modern Web Development | CETPA I...
Cetpa Infotech
 
Laravel : A Fastest Growing Kid
Laravel : A Fastest Growing KidLaravel : A Fastest Growing Kid
Laravel : A Fastest Growing Kid
Endive Software
 
Why Laravel is the first choice for Web development_.pdf
Why Laravel is the first choice for Web development_.pdfWhy Laravel is the first choice for Web development_.pdf
Why Laravel is the first choice for Web development_.pdf
Moon Technolabs Pvt. Ltd.
 
Laravel 9_ Unlock the Exciting Features Here!.pptx
Laravel 9_ Unlock the Exciting Features Here!.pptxLaravel 9_ Unlock the Exciting Features Here!.pptx
Laravel 9_ Unlock the Exciting Features Here!.pptx
Elsner Technologies Pvt. Ltd.
 

Similar to Laravel (20)

What’s New in Laravel 8 for a Laravel Development Company?
What’s New in Laravel 8 for a Laravel Development Company?What’s New in Laravel 8 for a Laravel Development Company?
What’s New in Laravel 8 for a Laravel Development Company?
 
Latest Laravel Practice 2023 Experts Guidance.pdf
Latest Laravel Practice 2023 Experts Guidance.pdfLatest Laravel Practice 2023 Experts Guidance.pdf
Latest Laravel Practice 2023 Experts Guidance.pdf
 
Web presentation
Web presentationWeb presentation
Web presentation
 
Laravel: Unleashing the power of PHP
Laravel: Unleashing the power  of PHPLaravel: Unleashing the power  of PHP
Laravel: Unleashing the power of PHP
 
Getting started with laravel
Getting started with laravelGetting started with laravel
Getting started with laravel
 
Laravel Web Development: A Comprehensive Guide
Laravel Web Development: A Comprehensive GuideLaravel Web Development: A Comprehensive Guide
Laravel Web Development: A Comprehensive Guide
 
Laravel (8) php_framework_handbook__start_from_zer_18604872_(z-lib.org)
Laravel (8) php_framework_handbook__start_from_zer_18604872_(z-lib.org)Laravel (8) php_framework_handbook__start_from_zer_18604872_(z-lib.org)
Laravel (8) php_framework_handbook__start_from_zer_18604872_(z-lib.org)
 
Laravel - A Trending PHP Framework
Laravel - A Trending PHP FrameworkLaravel - A Trending PHP Framework
Laravel - A Trending PHP Framework
 
Laravel 4 presentation
Laravel 4 presentationLaravel 4 presentation
Laravel 4 presentation
 
Who Should Consider Using Laravel for Web Development?
Who Should Consider Using Laravel for Web Development?Who Should Consider Using Laravel for Web Development?
Who Should Consider Using Laravel for Web Development?
 
Laravel Presentation
Laravel PresentationLaravel Presentation
Laravel Presentation
 
laravel-interview-questions.pdf
laravel-interview-questions.pdflaravel-interview-questions.pdf
laravel-interview-questions.pdf
 
Why is Laravel the best framework for startups?
Why is Laravel the best framework for startups?Why is Laravel the best framework for startups?
Why is Laravel the best framework for startups?
 
What makes Laravel the optimal framework for your project.pdf
What makes Laravel the optimal framework for your project.pdfWhat makes Laravel the optimal framework for your project.pdf
What makes Laravel the optimal framework for your project.pdf
 
Lecture11_LaravelGetStarted_SPring2023.pdf
Lecture11_LaravelGetStarted_SPring2023.pdfLecture11_LaravelGetStarted_SPring2023.pdf
Lecture11_LaravelGetStarted_SPring2023.pdf
 
Article laravel 8
Article laravel 8Article laravel 8
Article laravel 8
 
Unleashing the Power of Laravel A Journey to Modern Web Development | CETPA I...
Unleashing the Power of Laravel A Journey to Modern Web Development | CETPA I...Unleashing the Power of Laravel A Journey to Modern Web Development | CETPA I...
Unleashing the Power of Laravel A Journey to Modern Web Development | CETPA I...
 
Laravel : A Fastest Growing Kid
Laravel : A Fastest Growing KidLaravel : A Fastest Growing Kid
Laravel : A Fastest Growing Kid
 
Why Laravel is the first choice for Web development_.pdf
Why Laravel is the first choice for Web development_.pdfWhy Laravel is the first choice for Web development_.pdf
Why Laravel is the first choice for Web development_.pdf
 
Laravel 9_ Unlock the Exciting Features Here!.pptx
Laravel 9_ Unlock the Exciting Features Here!.pptxLaravel 9_ Unlock the Exciting Features Here!.pptx
Laravel 9_ Unlock the Exciting Features Here!.pptx
 

Recently uploaded

Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
kimdan468
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
Group Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana BuscigliopptxGroup Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana Buscigliopptx
ArianaBusciglio
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 

Recently uploaded (20)

Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
Group Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana BuscigliopptxGroup Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana Buscigliopptx
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 

Laravel

  • 1. WHAT IS LARAVEL ? Presented By Dyuti Islam 151-15-5435 Section:B
  • 2. CONTENTS …  What is Laravel ?  Install Laravel 5 with Composer  Files structure  What is artisan and how does it save us time?  Routing and route types  What is Middleware and how to use it?  What is Blade ?  Database and Eloquent ORM  CRUD with validation and database connection (practical task)  Best practices when coding in Laravel
  • 3. LERAVEL  Laravel is MVC PHP framework created by Taylor Otwell in 2011  Free open-source license with many contributors worldwide  One of the best frameworks together with Symfony, CodeIgniter, Yii  Has powerful features, saving us time  Uses Symfony packages  Lets see some statistics
  • 5. PHP FRAMEWORK POPULARITY AT WORK – SITEPOINT 2015
  • 6. FEATURES  Eloquent ORM (object-relational mapping) – implements ActiveRecord  Query builder – helps you to build secured SQL queries  Restful controllers – provides a way for separating the different HTTP requests (GET, POST, DELETE, etc.)  Blade template engine – combines templates with a data model to produce views  Migrations – version control system for database, update your database easier  Database seeding – provides a way to populate database tables with test data used for testing  Pagination – easy to use advanced pagination functionalities  Forms security – provides CSRF token middleware, protecting all the forms
  • 7. MUST HAVE PACKAGES  Laravel debugbar - https://github.com/barryvdh/laravel-debugbar Great for debugging on local environment. Shows all the views, requests, exceptions loaded for the current page.  LaravelCollective – Forms & HTML - https://laravelcollective.com/docs/master/html Perfect for generating forms, inputs, script tags and style tags  Laravel IDE Helper - https://github.com/barryvdh/laravel-ide-helper The package helps your IDE with autocomplete and autosuggest methods, views, functions and more.
  • 8. LET’S INSTALL LARAVEL  Laravel uses Composer to manage its dependencies  Composer is dependency management tool for PHP, like a library full of books  NOT like Yum or apt  Per project tool (vendor folder), not per system  Install by using the command: composer create-project --prefer-dist laravel/laravel laravel-softuni
  • 9. THE STRUCTURE app/Http folder contains the Controllers, Middlewares and Kernel file All the models should be located in app/Models folder All the config files are located in app/config folder The service providers that are bootstrapping functions in our app are located in app/Providers folder
  • 10. ARTISAN !  Artisan is command-line interface for Laravel  Commands that are saving time  Generating files with artisan is recommended  Run php artisan list in the console
  • 11. MIDDLEWARE  The middleware is mechanism for filtering the HTTP requests  Laravel includes several middlewares – Authentication, CSRF Protection  The auth middleware checks if the user visting the page is authenticated through session cookie  The CSRF token protection middleware protects your application from cross-site request forgery attacks by adding token key for each generated form  Let’s create middleware
  • 12. BLADE  Blade is the powerful template engine provided by Laravel  All the code inside blade file is compiled to static html file  Supports plain PHP  Saves time  Better components mobility, extend and include partials  Let’s take a look at few examples
  • 13. ELOQUENT & DATABASE  The Eloquent ORM (Object-relational mapping) provides simple ActiveRecord implementation for working with the database $article = new Article(); $article->title = ‘Article title’; $article->description = ‘Description’; $article->save(); INSERT INTO `article` (`title`, `description`) VALUES (‘Article title’, ‘Description’);
  • 14.  Each table has its own “Model”. You can use the model to read, insert, update or delete row from the specific table  Let’s check one model
  • 15. PRACTICAL TASK We will play with Laravel and create CRUD for recipes (Create, Read, Update, Delete). The recipe will have the following columns / fields : • Id – primary key – not null • Title – varchar – 255 length – not null • Description – text – nullable • Status – enum [ active / inactive ] – not null – defaults to active • Created At – datetime – not null • Updated At – datetime – not null
  • 16. BEST PRACTICES IN LARAVEL NEVER write queries or model logic inside the controller! The controller job is to communicate with the model and pass data to the view.
  • 17. VIEWS MOBILITY Extend and include partials. For example share the same form fields on 2 pages – add and edit
  • 18. FORMS SECURITY Always use the CSRF token protection that Laravel provides in forms you create, the hackers will not be able to spam your forms and database
  • 19. BIG QUERY • Avoid the big query unless you really have to do it. The big query is hard to debug and understand. • You can merge the small queries into one to save the CPU time on server, but sometimes the query becomes way too big.
  • 20. DON’T FORGET THE PHPDOC Don’t forget to write comments for each method or complicated logic. The PHPDoc comments are helping the IDE to autosuggest easier and the developers to understand the piece of code