SlideShare a Scribd company logo
1 of 12
Download to read offline
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

2009 God
2009 God2009 God
2009 God
xoanon
 
Interface database metadata
Interface database metadataInterface database metadata
Interface database metadata
myrajendra
 

What's hot (20)

David LeBauer PEcAn
David LeBauer PEcAnDavid LeBauer PEcAn
David LeBauer PEcAn
 
Efficient Spring Data REST Development
Efficient Spring Data REST DevelopmentEfficient Spring Data REST Development
Efficient Spring Data REST Development
 
Introduction to asp.net
Introduction to asp.netIntroduction to asp.net
Introduction to asp.net
 
SQL Injection Attacks
SQL Injection AttacksSQL Injection Attacks
SQL Injection Attacks
 
2009 God
2009 God2009 God
2009 God
 
Android content provider explained
Android content provider explainedAndroid content provider explained
Android content provider explained
 
Introducing Entity Framework Core
Introducing Entity Framework CoreIntroducing Entity Framework Core
Introducing Entity Framework Core
 
ASP.NET Lecture 4
ASP.NET Lecture 4ASP.NET Lecture 4
ASP.NET Lecture 4
 
141060753008 3715301
141060753008 3715301141060753008 3715301
141060753008 3715301
 
Building nTier Applications with Entity Framework Services (Part 1)
Building nTier Applications with Entity Framework Services (Part 1)Building nTier Applications with Entity Framework Services (Part 1)
Building nTier Applications with Entity Framework Services (Part 1)
 
Drupal as a data server
Drupal as a data serverDrupal as a data server
Drupal as a data server
 
Interface database metadata
Interface database metadataInterface database metadata
Interface database metadata
 
ADO.NET Data Services & Entity Framework
ADO.NET Data Services & Entity FrameworkADO.NET Data Services & Entity Framework
ADO.NET Data Services & Entity Framework
 
Ado.net
Ado.netAdo.net
Ado.net
 
Grid Vew Control VB
Grid Vew Control VBGrid Vew Control VB
Grid Vew Control VB
 
2014 Pre-MSc-IS-6 Presentation Layer
2014 Pre-MSc-IS-6 Presentation Layer2014 Pre-MSc-IS-6 Presentation Layer
2014 Pre-MSc-IS-6 Presentation Layer
 
Typical Architecture Of Automation Frameworks
Typical Architecture Of Automation FrameworksTypical Architecture Of Automation Frameworks
Typical Architecture Of Automation Frameworks
 
Building nTier Applications with Entity Framework Services
Building nTier Applications with Entity Framework ServicesBuilding nTier Applications with Entity Framework Services
Building nTier Applications with Entity Framework Services
 
an implementation of repository pattern for mobile application
an implementation of repository pattern for mobile applicationan implementation of repository pattern for mobile application
an implementation of repository pattern for mobile application
 
Protocol oriented programming
Protocol oriented programmingProtocol oriented programming
Protocol oriented programming
 

Similar to Web Programming - 5 Passing and Request Data

Ijarcet vol-2-issue-7-2236-2240
Ijarcet vol-2-issue-7-2236-2240Ijarcet vol-2-issue-7-2236-2240
Ijarcet vol-2-issue-7-2236-2240
Editor IJARCET
 
Ijarcet vol-2-issue-7-2236-2240
Ijarcet vol-2-issue-7-2236-2240Ijarcet vol-2-issue-7-2236-2240
Ijarcet vol-2-issue-7-2236-2240
Editor IJARCET
 
Differences Between Architectures
Differences Between ArchitecturesDifferences Between Architectures
Differences Between Architectures
prasadsmn
 
Repository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity FrameworkRepository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity Framework
Akhil Mittal
 

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

ANDROID BASED WS SECURITY AND MVC BASED UI REPRESENTATION OF DATA
ANDROID BASED WS SECURITY AND MVC BASED UI REPRESENTATION OF DATAANDROID BASED WS SECURITY AND MVC BASED UI REPRESENTATION OF DATA
ANDROID BASED WS SECURITY AND MVC BASED UI REPRESENTATION OF DATA
 
Ijarcet vol-2-issue-7-2236-2240
Ijarcet vol-2-issue-7-2236-2240Ijarcet vol-2-issue-7-2236-2240
Ijarcet vol-2-issue-7-2236-2240
 
Ijarcet vol-2-issue-7-2236-2240
Ijarcet vol-2-issue-7-2236-2240Ijarcet vol-2-issue-7-2236-2240
Ijarcet vol-2-issue-7-2236-2240
 
Unit III.docx
Unit  III.docxUnit  III.docx
Unit III.docx
 
Programming Without Coding Technology (PWCT) Features - Programming Paradigm
Programming Without Coding Technology (PWCT) Features - Programming ParadigmProgramming Without Coding Technology (PWCT) Features - Programming Paradigm
Programming Without Coding Technology (PWCT) Features - Programming Paradigm
 
Migration of application schema to windows azure
Migration of application schema to windows azureMigration of application schema to windows azure
Migration of application schema to windows azure
 
Key projects Data Science and Engineering
Key projects Data Science and EngineeringKey projects Data Science and Engineering
Key projects Data Science and Engineering
 
Key projects Data Science and Engineering
Key projects Data Science and EngineeringKey projects Data Science and Engineering
Key projects Data Science and Engineering
 
Differences Between Architectures
Differences Between ArchitecturesDifferences Between Architectures
Differences Between Architectures
 
Sq lite module9
Sq lite module9Sq lite module9
Sq lite module9
 
Configuring LIFA for remote communication using web architecture
Configuring LIFA for remote communication using web architecture Configuring LIFA for remote communication using web architecture
Configuring LIFA for remote communication using web architecture
 
A Deep Dive into REST API Framework Survey
A Deep Dive into REST API Framework SurveyA Deep Dive into REST API Framework Survey
A Deep Dive into REST API Framework Survey
 
MongoDB.pdf
MongoDB.pdfMongoDB.pdf
MongoDB.pdf
 
Access Control and Revocation for Digital Assets on Cloud with Consideration ...
Access Control and Revocation for Digital Assets on Cloud with Consideration ...Access Control and Revocation for Digital Assets on Cloud with Consideration ...
Access Control and Revocation for Digital Assets on Cloud with Consideration ...
 
Modeling Local Broker Policy Based on Workload Profile in Network Cloud
Modeling Local Broker Policy Based on Workload Profile in Network CloudModeling Local Broker Policy Based on Workload Profile in Network Cloud
Modeling Local Broker Policy Based on Workload Profile in Network Cloud
 
Sending the data already gathered from the client to the Server
Sending the data already gathered from the client to the ServerSending the data already gathered from the client to the Server
Sending the data already gathered from the client to the Server
 
Cobe framework cloud ontology blackboard environment for enhancing discovery ...
Cobe framework cloud ontology blackboard environment for enhancing discovery ...Cobe framework cloud ontology blackboard environment for enhancing discovery ...
Cobe framework cloud ontology blackboard environment for enhancing discovery ...
 
Repository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity FrameworkRepository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity Framework
 
Work with data in ASP.NET
Work with data in ASP.NETWork with data in ASP.NET
Work with data in ASP.NET
 
Research Inventy : International Journal of Engineering and Science
Research Inventy : International Journal of Engineering and ScienceResearch Inventy : International Journal of Engineering and Science
Research Inventy : International Journal of Engineering and Science
 

More from AndiNurkholis1

More from AndiNurkholis1 (20)

Mobile Programming - 10 Firebase
Mobile Programming - 10 FirebaseMobile Programming - 10 Firebase
Mobile Programming - 10 Firebase
 
Mobile Programming - 9 Profile UI, Navigation Basic and Splash Screen
Mobile Programming - 9 Profile UI, Navigation Basic and Splash ScreenMobile Programming - 9 Profile UI, Navigation Basic and Splash Screen
Mobile Programming - 9 Profile UI, Navigation Basic and Splash Screen
 
Mobile Programming - 8 Progress Bar, Draggable Music Knob, Timer
Mobile Programming - 8 Progress Bar, Draggable Music Knob, TimerMobile Programming - 8 Progress Bar, Draggable Music Knob, Timer
Mobile Programming - 8 Progress Bar, Draggable Music Knob, Timer
 
Mobile Programming - 7 Side Effects, Effect Handlers, and Simple Animations
Mobile Programming - 7 Side Effects, Effect Handlers, and Simple AnimationsMobile Programming - 7 Side Effects, Effect Handlers, and Simple Animations
Mobile Programming - 7 Side Effects, Effect Handlers, and Simple Animations
 
Mobile Programming - 6 Textfields, Button, Showing Snackbars and Lists
Mobile Programming - 6 Textfields, Button, Showing Snackbars and ListsMobile Programming - 6 Textfields, Button, Showing Snackbars and Lists
Mobile Programming - 6 Textfields, Button, Showing Snackbars and Lists
 
Mobile Programming - 5 Stylling Text and State
Mobile Programming - 5 Stylling Text and StateMobile Programming - 5 Stylling Text and State
Mobile Programming - 5 Stylling Text and State
 
Mobile Programming - 4 Modifiers and Image Card
Mobile Programming - 4 Modifiers and Image CardMobile Programming - 4 Modifiers and Image Card
Mobile Programming - 4 Modifiers and Image Card
 
Mobile Programming - 3 Rows, Column and Basic Sizing
Mobile Programming - 3 Rows, Column and Basic SizingMobile Programming - 3 Rows, Column and Basic Sizing
Mobile Programming - 3 Rows, Column and Basic Sizing
 
Algoritma dan Struktur Data (Python) - Struktur Data
Algoritma dan Struktur Data (Python) - Struktur DataAlgoritma dan Struktur Data (Python) - Struktur Data
Algoritma dan Struktur Data (Python) - Struktur Data
 
Mobile Programming - 2 Jetpack Compose
Mobile Programming - 2 Jetpack ComposeMobile Programming - 2 Jetpack Compose
Mobile Programming - 2 Jetpack Compose
 
Mobile Programming - 1 Introduction
Mobile Programming - 1 IntroductionMobile Programming - 1 Introduction
Mobile Programming - 1 Introduction
 
Algoritma dan Struktur Data (Python) - Perulangan
Algoritma dan Struktur Data (Python) - PerulanganAlgoritma dan Struktur Data (Python) - Perulangan
Algoritma dan Struktur Data (Python) - Perulangan
 
Algoritma dan Struktur Data (Python) - Percabangan
Algoritma dan Struktur Data (Python) - PercabanganAlgoritma dan Struktur Data (Python) - Percabangan
Algoritma dan Struktur Data (Python) - Percabangan
 
Algoritma dan Struktur Data (Python) - Struktur I/O
Algoritma dan Struktur Data (Python) - Struktur I/OAlgoritma dan Struktur Data (Python) - Struktur I/O
Algoritma dan Struktur Data (Python) - Struktur I/O
 
Algoritma dan Struktur Data (Python) - Notasi Algoritmik
Algoritma dan Struktur Data (Python) - Notasi AlgoritmikAlgoritma dan Struktur Data (Python) - Notasi Algoritmik
Algoritma dan Struktur Data (Python) - Notasi Algoritmik
 
Algoritma dan Struktur Data (Python) - Pengantar Algoritma
Algoritma dan Struktur Data (Python) - Pengantar AlgoritmaAlgoritma dan Struktur Data (Python) - Pengantar Algoritma
Algoritma dan Struktur Data (Python) - Pengantar Algoritma
 
Algorithm and Data Structure - Binary Search
Algorithm and Data Structure - Binary SearchAlgorithm and Data Structure - Binary Search
Algorithm and Data Structure - Binary Search
 
Algorithm and Data Structure - Linear Search
Algorithm and Data Structure - Linear SearchAlgorithm and Data Structure - Linear Search
Algorithm and Data Structure - Linear Search
 
Algorithm and Data Structure - Queue
Algorithm and Data Structure - QueueAlgorithm and Data Structure - Queue
Algorithm and Data Structure - Queue
 
Algorithm and Data Structure - Stack
Algorithm and Data Structure - StackAlgorithm and Data Structure - Stack
Algorithm and Data Structure - Stack
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

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