SlideShare a Scribd company logo
Study Program of Information Systems
Faculty of Engineering and Computer Science
SY. 2020-2021
Andi Nurkholis, S.Kom., M.Kom.
October 19, 2020
2
3
Passing data is process of how we can take variable data,
and pass it to our views to be rendered in the Browser.
4
Laravel provides
different ways to pass
data to a view. We can
pass data directly from
routes or through the
controller
• Using view()
• Using with()
• Using compact()
• Using Controller
Class
We can directly pass the data in the ‘view()’
helper function by using the second parameter
in the function which takes an array as key and
value pair
In view(), the first parameter is the name of the
view and the second parameter is where we
have specified one key and multiple values of
the data.5
The ‘with()’ is a method to pass individual form of data
and is used with the ‘view’ helper function
As you can see in the above code, we have to specify an
arrow ‘->’ and then use the ‘with()’ method with ‘view()’
helper function. And we can specify one or more ‘with()’
depending on the requirement and use case.
6
The ‘compact()’ is a PHP function that can be used for creating an
array with variable and there value. Here the name on the
variable is the key and the variable content is the value
In view(), the first parameter is the name of the view and second
is where we have to specify the ‘compact()’ function.
7
Passing data using controller class is easy and is the right way
In above function, we saw that we make use of the view() function.
It’s first argument is a string which specifies which view file to
load. The second argument to view() is an array which holds
dynamic data that we can pass to the view file.
8
HTTP works as a request-response protocol between a
client and server.
Example: A client (browser) sends an HTTP request to
the server; then the server returns a response to the
client. The response contains status information about
the request and may also contain the requested content.
So, request is what the client asks for the server to fulfill
9
10
To obtain an instance of the current HTTP
request via dependency injection, you should
type-hint the IlluminateHttpRequest class on
your controller method.
11
Andi Nurkholis, S.Kom., M.Kom.
September 28, 2020October 19, 2020
Study Program of Information Systems
Faculty of Engineering and Computer Science
SY. 2020-2021

More Related Content

What's hot (20)

PPTX
David LeBauer PEcAn
David LeBauer
 
PPTX
Efficient Spring Data REST Development
Catalin Tudose
 
PPTX
Introduction to asp.net
neeta1995
 
PPTX
SQL Injection Attacks
HTS Hosting
 
PPTX
2009 God
xoanon
 
PPTX
Android content provider explained
Shady Selim
 
PPTX
Introducing Entity Framework Core
Joy Sarker
 
PPTX
ASP.NET Lecture 4
Julie Iskander
 
PPT
141060753008 3715301
ITM Universe - Vadodara
 
PPTX
Building nTier Applications with Entity Framework Services (Part 1)
David McCarter
 
PPTX
Drupal as a data server
Jay Friendly
 
PPTX
Interface database metadata
myrajendra
 
PPTX
ADO.NET Data Services & Entity Framework
dyana0106
 
PPTX
Ado.net
qamar mustafa
 
PPTX
Grid Vew Control VB
sunmitraeducation
 
PDF
2014 Pre-MSc-IS-6 Presentation Layer
andreasmartin
 
DOC
Typical Architecture Of Automation Frameworks
Yogindernath Gupta
 
PPTX
Building nTier Applications with Entity Framework Services
David McCarter
 
ODP
an implementation of repository pattern for mobile application
Arif Huda
 
PDF
Protocol oriented programming
Arif Huda
 
David LeBauer PEcAn
David LeBauer
 
Efficient Spring Data REST Development
Catalin Tudose
 
Introduction to asp.net
neeta1995
 
SQL Injection Attacks
HTS Hosting
 
2009 God
xoanon
 
Android content provider explained
Shady Selim
 
Introducing Entity Framework Core
Joy Sarker
 
ASP.NET Lecture 4
Julie Iskander
 
141060753008 3715301
ITM Universe - Vadodara
 
Building nTier Applications with Entity Framework Services (Part 1)
David McCarter
 
Drupal as a data server
Jay Friendly
 
Interface database metadata
myrajendra
 
ADO.NET Data Services & Entity Framework
dyana0106
 
Ado.net
qamar mustafa
 
Grid Vew Control VB
sunmitraeducation
 
2014 Pre-MSc-IS-6 Presentation Layer
andreasmartin
 
Typical Architecture Of Automation Frameworks
Yogindernath Gupta
 
Building nTier Applications with Entity Framework Services
David McCarter
 
an implementation of repository pattern for mobile application
Arif Huda
 
Protocol oriented programming
Arif Huda
 

Similar to Web Programming - 5 Passing and Request Data (20)

PPTX
Lecture 4_Laravel Controller and Data Pass-Route.pptx
SaziaRahman
 
PPTX
Laravel5 Introduction and essentials
Pramod Kadam
 
PPTX
4. Web programming MVC.pptx
KrisnaBayu41
 
PPTX
Laravel - Website Development in Php Framework.
SWAAM Tech
 
PPTX
Laravel 5
Sudip Simkhada
 
PDF
Web Programming - 4 Route, View, and Controller
AndiNurkholis1
 
PDF
Laravel Level 1 (The Basic)
Kriangkrai Chaonithi
 
PPTX
introduction to Laravel and its Basic and origin
Karthik Rohan
 
PDF
MidwestPHP 2016 - Adventures in Laravel 5
Joe Ferguson
 
PPTX
CRUD presentation of laravel application.pptx
ShoukatRiaz
 
PDF
Object Oriented Programming with Laravel - Session 3
Shahrzad Peyman
 
PDF
Object Oriented Programming with Laravel - Session 4
Shahrzad Peyman
 
PDF
Laravel 101
Commit University
 
PPTX
Laravel for Web Artisans
Raf Kewl
 
PDF
Laravelcollectionsunraveled
Renato Lucena
 
PPTX
Introduction to Laravel
Vin Lim
 
PPTX
Getting started with laravel
Advance Idea Infotech
 
PDF
Web Programming - 7 Blading Template
AndiNurkholis1
 
DOCX
Laravel
biplob04
 
PDF
Object Oriented Programming with Laravel - Session 5
Shahrzad Peyman
 
Lecture 4_Laravel Controller and Data Pass-Route.pptx
SaziaRahman
 
Laravel5 Introduction and essentials
Pramod Kadam
 
4. Web programming MVC.pptx
KrisnaBayu41
 
Laravel - Website Development in Php Framework.
SWAAM Tech
 
Laravel 5
Sudip Simkhada
 
Web Programming - 4 Route, View, and Controller
AndiNurkholis1
 
Laravel Level 1 (The Basic)
Kriangkrai Chaonithi
 
introduction to Laravel and its Basic and origin
Karthik Rohan
 
MidwestPHP 2016 - Adventures in Laravel 5
Joe Ferguson
 
CRUD presentation of laravel application.pptx
ShoukatRiaz
 
Object Oriented Programming with Laravel - Session 3
Shahrzad Peyman
 
Object Oriented Programming with Laravel - Session 4
Shahrzad Peyman
 
Laravel 101
Commit University
 
Laravel for Web Artisans
Raf Kewl
 
Laravelcollectionsunraveled
Renato Lucena
 
Introduction to Laravel
Vin Lim
 
Getting started with laravel
Advance Idea Infotech
 
Web Programming - 7 Blading Template
AndiNurkholis1
 
Laravel
biplob04
 
Object Oriented Programming with Laravel - Session 5
Shahrzad Peyman
 
Ad

More from AndiNurkholis1 (20)

PDF
Technopreneurship - 9 Analisis Biaya dan Keuangan
AndiNurkholis1
 
PDF
Pengantar Bisnis - 14 Manajemen Keuangan
AndiNurkholis1
 
PDF
Pengantar Bisnis - 13 Manajemen Operasi
AndiNurkholis1
 
PDF
Pengantar Bisnis - 12 Kebijakan Harga
AndiNurkholis1
 
PDF
Pengantar Bisnis - 11 Kebijakan Distribusi
AndiNurkholis1
 
PDF
Technopreneurship - 8 Manajemen Sumber Daya Manusia
AndiNurkholis1
 
PDF
Pengantar Bisnis - 10 Kebijakan Produk
AndiNurkholis1
 
PDF
Technopreneurship - 7 Manajemen Pemasaran dan Operasional Bisnis
AndiNurkholis1
 
PDF
Pengantar Bisnis - 9 Manajemen Pemasaran
AndiNurkholis1
 
PDF
Technopreneurship - 6 Business Plan
AndiNurkholis1
 
PDF
Pengantar Bisnis - 8 Kepemimpinan
AndiNurkholis1
 
PDF
Technopreneurship - 5 Model Bisnis
AndiNurkholis1
 
PDF
Technopreneurship - 4 Studi Kelayakan Usaha
AndiNurkholis1
 
PDF
Pengantar Bisnis - 7 Motivasi Kerja
AndiNurkholis1
 
PDF
Pengantar Bisnis - 6 Manajemen Sumber Daya Manusia
AndiNurkholis1
 
PDF
Pengantar Bisnis - 5 Pengelolaan & Pengorganisasian Bisnis
AndiNurkholis1
 
PDF
Technopreneurship - 3 Ide dan Prinsip Bisnis
AndiNurkholis1
 
PDF
Pengantar Bisnis - 4 Bentuk Organisasi Bisnis
AndiNurkholis1
 
PDF
Technopreneurship - 2 Pengantar Technopreneurship
AndiNurkholis1
 
PDF
Pengantar Bisnis - 3 Globalisasi Ekonomi & Bisnis Internasional
AndiNurkholis1
 
Technopreneurship - 9 Analisis Biaya dan Keuangan
AndiNurkholis1
 
Pengantar Bisnis - 14 Manajemen Keuangan
AndiNurkholis1
 
Pengantar Bisnis - 13 Manajemen Operasi
AndiNurkholis1
 
Pengantar Bisnis - 12 Kebijakan Harga
AndiNurkholis1
 
Pengantar Bisnis - 11 Kebijakan Distribusi
AndiNurkholis1
 
Technopreneurship - 8 Manajemen Sumber Daya Manusia
AndiNurkholis1
 
Pengantar Bisnis - 10 Kebijakan Produk
AndiNurkholis1
 
Technopreneurship - 7 Manajemen Pemasaran dan Operasional Bisnis
AndiNurkholis1
 
Pengantar Bisnis - 9 Manajemen Pemasaran
AndiNurkholis1
 
Technopreneurship - 6 Business Plan
AndiNurkholis1
 
Pengantar Bisnis - 8 Kepemimpinan
AndiNurkholis1
 
Technopreneurship - 5 Model Bisnis
AndiNurkholis1
 
Technopreneurship - 4 Studi Kelayakan Usaha
AndiNurkholis1
 
Pengantar Bisnis - 7 Motivasi Kerja
AndiNurkholis1
 
Pengantar Bisnis - 6 Manajemen Sumber Daya Manusia
AndiNurkholis1
 
Pengantar Bisnis - 5 Pengelolaan & Pengorganisasian Bisnis
AndiNurkholis1
 
Technopreneurship - 3 Ide dan Prinsip Bisnis
AndiNurkholis1
 
Pengantar Bisnis - 4 Bentuk Organisasi Bisnis
AndiNurkholis1
 
Technopreneurship - 2 Pengantar Technopreneurship
AndiNurkholis1
 
Pengantar Bisnis - 3 Globalisasi Ekonomi & Bisnis Internasional
AndiNurkholis1
 
Ad

Recently uploaded (20)

PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
Biography of Daniel Podor.pdf
Daniel Podor
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Advancing WebDriver BiDi support in WebKit
Igalia
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Biography of Daniel Podor.pdf
Daniel Podor
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Advancing WebDriver BiDi support in WebKit
Igalia
 

Web Programming - 5 Passing and Request Data

  • 1. Study Program of Information Systems Faculty of Engineering and Computer Science SY. 2020-2021 Andi Nurkholis, S.Kom., M.Kom. October 19, 2020
  • 2. 2
  • 3. 3 Passing data is process of how we can take variable data, and pass it to our views to be rendered in the Browser.
  • 4. 4 Laravel provides different ways to pass data to a view. We can pass data directly from routes or through the controller • Using view() • Using with() • Using compact() • Using Controller Class
  • 5. We can directly pass the data in the ‘view()’ helper function by using the second parameter in the function which takes an array as key and value pair In view(), the first parameter is the name of the view and the second parameter is where we have specified one key and multiple values of the data.5
  • 6. The ‘with()’ is a method to pass individual form of data and is used with the ‘view’ helper function As you can see in the above code, we have to specify an arrow ‘->’ and then use the ‘with()’ method with ‘view()’ helper function. And we can specify one or more ‘with()’ depending on the requirement and use case. 6
  • 7. The ‘compact()’ is a PHP function that can be used for creating an array with variable and there value. Here the name on the variable is the key and the variable content is the value In view(), the first parameter is the name of the view and second is where we have to specify the ‘compact()’ function. 7
  • 8. Passing data using controller class is easy and is the right way In above function, we saw that we make use of the view() function. It’s first argument is a string which specifies which view file to load. The second argument to view() is an array which holds dynamic data that we can pass to the view file. 8
  • 9. HTTP works as a request-response protocol between a client and server. Example: A client (browser) sends an HTTP request to the server; then the server returns a response to the client. The response contains status information about the request and may also contain the requested content. So, request is what the client asks for the server to fulfill 9
  • 10. 10
  • 11. To obtain an instance of the current HTTP request via dependency injection, you should type-hint the IlluminateHttpRequest class on your controller method. 11
  • 12. Andi Nurkholis, S.Kom., M.Kom. September 28, 2020October 19, 2020 Study Program of Information Systems Faculty of Engineering and Computer Science SY. 2020-2021