SlideShare ist ein Scribd-Unternehmen logo
1 von 28
Introduction to Laravel
framework
“Love beautiful code? We do too.”
About Speaker
Ahmad Fatoni
[fatoni@dot-indonesia.com]
Web Developer at DOT Indonesia
(PT Distinction On Technology Indonesia)
Laravel
(2011
)
V5.5
(2017
)
Taylor Otwell
Laravel Horizon | Laravel Dusk | Laravel Echo | Valet | Lumen | and more….
Today Topic
� Architecture
� Routing
� Controller
� Model
� Views
� Migration
� Query Builder
� Eloquent
� Composer support
Architecture
Architecture
Routing
� Default route files : routes/web.php and routes/api.php
� Available method : GET, POST, PUT, PATCH, DELETE, OPTIONS
� CSRF protection
� Using parameter(s) : Route::get('users/{id}', ['uses' => 'UserController@show]);
� Named route : Route::get('users/{id}', ['uses' =>UserController@show])->name(‘show’);
� Grouping
Controller
� Default folder : app/Http/Controllers
� Connecting model and view (see the architecture)
� ‘Request’ handler : IlluminateHttpRequest
○ all()
○ only()
○ except()
○ json()
○ And more (https://laravel.com/api/5.5/Illuminate/Http/Request.html)
Controller
Controller
� Return view response : return view('auth.login');
� Compacting data to view
$data['member'] = [ 'fatoni', 'kennan' ];
return view('member.index', compact('data'));
� Redirect to route : return redirect()->route('member.index');
Model
� Default folder : app
� Connecting app with database
� Awesome Eloquent
Model
Views
� Default folder : resources/views
� Blade templating (https://laravel.com/docs/5.5/blade)
Views
� Easy to organizing
Views
� Easy to organizing
Migrations
� Default folder : database/migrations
� Build database from application
� Easily modify and share database schema
� Creating foreign key (relationship)
Migrations
CreateRolesTable CreatePermissionRoleTable
Migrations
Query Builder
Get Data
� Query Builder :
○ $users = DB::table('users')->get();
� SQL Query
○ $sql = "SELECT * FROM users”;
Insert Data
� Query Builder :
○ $result = DB::table('users')->insert([‘colum1’ => ‘values1’, ‘column2’ => ‘values2’]);
○ $result = DB::table(users’)->insert($request->all());
� SQL Query
○ INSERT INTO users (column1, column2.) VALUES (value1, value2)
Query Builder
Update Data
� Query Builder :
○ $result = DB::table('users')->where(‘id’, ‘=’, 1)->update([‘colum1’ => ‘values1’,
‘column2’ => ‘values2’]);
○ $result = DB::table(users’)->where(‘id’, ‘=’, 1)->insert($request->all());
� SQL Query
○ UPDATE users SET column1=value, column2=value2 WHERE id=1
Eloquent
� Awesome collections ( all(), create(), update(), etc )
� Accessors & Mutators
� Easy managing and working with relationships
� Serializations
Eloquent
� Awesome collections ( all(), create(), update(), etc )
Eloquent
� Accessors & Mutators
Accessor
Mutator
Eloquent
� Easy managing and working with relationships
○ One To One
○ One To Many
○ Many To Many
○ Has Many Through
○ Polymorphic Relations
○ Many To Many Polymorphic Relations
Eloquent
� Easy managing and working with relationships
○ One To One
Call it :
$phone = User::find(1)->phone;
Eloquent
� Serializations
○ Serializing To Arrays
○ Serializing To JSON
Composer support
Introduction to laravel framework

Weitere ähnliche Inhalte

Was ist angesagt?

Introduction To Single Page Application
Introduction To Single Page ApplicationIntroduction To Single Page Application
Introduction To Single Page Application
KMS Technology
 
Web application development with laravel php framework version 4
Web application development with laravel php framework version 4Web application development with laravel php framework version 4
Web application development with laravel php framework version 4
Untung D Saptoto
 

Was ist angesagt? (20)

Why Laravel?
Why Laravel?Why Laravel?
Why Laravel?
 
What-is-Laravel-23-August-2017.pptx
What-is-Laravel-23-August-2017.pptxWhat-is-Laravel-23-August-2017.pptx
What-is-Laravel-23-August-2017.pptx
 
laravel.pptx
laravel.pptxlaravel.pptx
laravel.pptx
 
Laravel
LaravelLaravel
Laravel
 
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
 
Laravel Eloquent ORM
Laravel Eloquent ORMLaravel Eloquent ORM
Laravel Eloquent ORM
 
Spring MVC
Spring MVCSpring MVC
Spring MVC
 
Introduction To Single Page Application
Introduction To Single Page ApplicationIntroduction To Single Page Application
Introduction To Single Page Application
 
Web api
Web apiWeb api
Web api
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Web application development with laravel php framework version 4
Web application development with laravel php framework version 4Web application development with laravel php framework version 4
Web application development with laravel php framework version 4
 
Spring Boot Tutorial
Spring Boot TutorialSpring Boot Tutorial
Spring Boot Tutorial
 
Spring Framework
Spring Framework  Spring Framework
Spring Framework
 
Angular Directives
Angular DirectivesAngular Directives
Angular Directives
 
JPA and Hibernate
JPA and HibernateJPA and Hibernate
JPA and Hibernate
 
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
 
Spring boot
Spring bootSpring boot
Spring boot
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Spring Framework - MVC
Spring Framework - MVCSpring Framework - MVC
Spring Framework - MVC
 
Laravel Routing and Query Building
Laravel   Routing and Query BuildingLaravel   Routing and Query Building
Laravel Routing and Query Building
 

Ähnlich wie Introduction to laravel framework

Corephpcomponentpresentation 1211425966721657-8
Corephpcomponentpresentation 1211425966721657-8Corephpcomponentpresentation 1211425966721657-8
Corephpcomponentpresentation 1211425966721657-8
PrinceGuru MS
 
Web Technologies - forms and actions
Web Technologies -  forms and actionsWeb Technologies -  forms and actions
Web Technologies - forms and actions
Aren Zomorodian
 

Ähnlich wie Introduction to laravel framework (20)

Laravel for Web Artisans
Laravel for Web ArtisansLaravel for Web Artisans
Laravel for Web Artisans
 
RESTful web services
RESTful web servicesRESTful web services
RESTful web services
 
Doctrine For Beginners
Doctrine For BeginnersDoctrine For Beginners
Doctrine For Beginners
 
Php summary
Php summaryPhp summary
Php summary
 
Data models in Angular 1 & 2
Data models in Angular 1 & 2Data models in Angular 1 & 2
Data models in Angular 1 & 2
 
SF Elixir Meetup - RethinkDB
SF Elixir Meetup - RethinkDBSF Elixir Meetup - RethinkDB
SF Elixir Meetup - RethinkDB
 
Angular 2 Architecture (Bucharest 26/10/2016)
Angular 2 Architecture (Bucharest 26/10/2016)Angular 2 Architecture (Bucharest 26/10/2016)
Angular 2 Architecture (Bucharest 26/10/2016)
 
Laravel
LaravelLaravel
Laravel
 
What's new in the Drupal 7 API?
What's new in the Drupal 7 API?What's new in the Drupal 7 API?
What's new in the Drupal 7 API?
 
Laravel5 Introduction and essentials
Laravel5 Introduction and essentialsLaravel5 Introduction and essentials
Laravel5 Introduction and essentials
 
Core Php Component Presentation
Core Php Component PresentationCore Php Component Presentation
Core Php Component Presentation
 
Corephpcomponentpresentation 1211425966721657-8
Corephpcomponentpresentation 1211425966721657-8Corephpcomponentpresentation 1211425966721657-8
Corephpcomponentpresentation 1211425966721657-8
 
Protractor framework – how to make stable e2e tests for Angular applications
Protractor framework – how to make stable e2e tests for Angular applicationsProtractor framework – how to make stable e2e tests for Angular applications
Protractor framework – how to make stable e2e tests for Angular applications
 
JS Fest 2019/Autumn. Maciej Treder. Angular Schematics - Develop for developers
JS Fest 2019/Autumn. Maciej Treder. Angular Schematics - Develop for developersJS Fest 2019/Autumn. Maciej Treder. Angular Schematics - Develop for developers
JS Fest 2019/Autumn. Maciej Treder. Angular Schematics - Develop for developers
 
Scalable web application architecture
Scalable web application architectureScalable web application architecture
Scalable web application architecture
 
Backbone js
Backbone jsBackbone js
Backbone js
 
Advanced Php - Macq Electronique 2010
Advanced Php - Macq Electronique 2010Advanced Php - Macq Electronique 2010
Advanced Php - Macq Electronique 2010
 
REST APIs in Laravel 101
REST APIs in Laravel 101REST APIs in Laravel 101
REST APIs in Laravel 101
 
Web Technologies - forms and actions
Web Technologies -  forms and actionsWeb Technologies -  forms and actions
Web Technologies - forms and actions
 
SEF2013 - A jQuery Primer for SharePoint
SEF2013 - A jQuery Primer for SharePointSEF2013 - A jQuery Primer for SharePoint
SEF2013 - A jQuery Primer for SharePoint
 

Kürzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Kürzlich hochgeladen (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
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...
 
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
 
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
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
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
 
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...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
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
 

Introduction to laravel framework