SlideShare a Scribd company logo
1 of 22
Laravel @ Kelltontech
22nd
November '16
What's Laravel ?
THE PHP FRAMEWORK FOR WEB ARTISANS.
PHP THAT DOESN'T HURT. CODE HAPPY & ENJOY THE FRESH AIR.
Where To Start From?
Laravel is very flexible framwork. There are at
least 3 options how to create new project:
✔ via laravel installer
✔ via composer
✔ clone from github
Via Laravel Installer?
This will download laravel installer via composer
composer global require "laravel/installer"
This simple command will create app
laravel new blog
Other Options
Via composer
composer create-project --prefer-dist laravel/laravel blog
Get From github
https://github.com/laravel/laravel
Development Environment
After installing Laravel, you should configure your web
server's document / web root to be the public directory. The
index.php in this directory serves as the front controller for all
HTTP requests entering your application.
Laravel and Composer
✔ Add/remove/update packages
✔ Dump autoload file and generate new one
✔ Update laravel version
Laravel Directory Structure
✔ The app directory, as you might expect, contains the core code of your application.
✔ The bootstrap directory contains files that bootstrap the framework and configure
autoloading.
✔ The config directory, as the name implies, contains all of your application's
configuration files
✔ The database directory contains your database migration and seeds.
✔ The public directory contains the index.php file.
✔ The resources directory contains your views as well as your raw, un-compiled assets
such as views.
More Directories
✔ The routes directory contains all of the route definitions for your application.
- The web.php file contains routes that the RouteServiceProvider places in the web
middleware group,
- The api.php file contains routes that the RouteServiceProvider places in the api
middleware group,
- The console.php file is where you may define all of your Closure based console
commands.
✔ The storage directory contains your compiled Blade templates, file based sessions, file
caches, and other files generated by the framework.
✔ The vendor directory contains your Composer dependencies.
Magic Artisan
Command line tool for web artisans
php artisan list
Basically artisan is a php script which performs all actions in
Laravel for example:
✔ Manage migrations
✔ Check application routes
✔ Clear app cache
✔ Create Artisan command
✔ Run database seeds
Laravel And Namespaces
Laravel actively uses php namespaces to keep classnames
short and keep possibility to use same class names for
different components.
I would suggest everyone to use namespaces too. For
example all Admin functionality under Admin namespace.
Laravel Routes
Route::get('foo', callback);
Route::get('/welcome/{name?}', function($name = null){
return 'Name comes from paramatere >> '.$name;
})->where('name', '[A-Za-z]+');
Route::group(['prefix' => 'name'], function () {
Route::get('/user/profile', function () {
return 'name with profile.';
});
});
Routing Helping Methods
Route::current();
Route::currentRouteName();
Route::currentRouteAction();
Laravel Middlewares
Before / After Middleware
✔ Middleware provide a convenient mechanism for filtering HTTP
requests entering your application.
✔ php artisan make:middleware CheckAge
✔ Location of create middleware app/Http/Middleware
✔ If you want a middleware to run during every HTTP request to your application,
simply list the middleware class in the $middleware property of your
app/Http/Kernel.php class.
Laravel Controllers
php artisan make:controller newController –resource
There’s one main Controller class which all controllers should extend. By
default Laravel has BaseController (extends from Controller) and
HomeController (extends from BaseController)
class UserController extends Controller{
public function __construct(){
$this->middleware('auth');
}
}
Talking About Views
✔ All views are located in app/views directory
✔ Can be separated in subdirectories
✔ Can be both blade or simple php files
✔ It is recommended to use balde template engine since it is
very convenient and helps to eliminate random logic blocks
in views
✔ View::make(‘user.profile’, $data)
Insights In Blade
Comments
{{-- Comment visible only in blade file --}}
Loops:
@forelse($users as $user)
<li>{{ $user->name }}</li>
@empty
<p>No users</p>
@endforelse
Conditions:
@unless (Auth::check()) // similar to if(!)
You are not signed in.
@endunless
Models
✔ Models are located under app/ directory.
✔ php artisan make:model Userkelltontech.
✔ Table convention is "snake cased" flights for Flight Model.
✔ Protect mass update protected $fillable = ['name'];/ guarded
✔ AppFlight::findOrFail(1);
✔ FindOrFail(1);
✔ Flight::popular()->women()->orderBy('created_at')->get();
Enable soft Delete
✔ Add deleted_at
✔ use IlluminateDatabaseEloquentSoftDeletes;
✔ Use trait SoftDeletes;
Laravel Migrations
✔ php artisan make:migration create_users_table –create=flights
✔ Each migration has two functions up and down to migrate and rollback
$table->increments('id');
$table->string('name', 255);
$table->string('email', 255);
$table->integer('nerd_level');
$table->timestamps();
Useful General Modules
✔ Queue
✔ Events File
✔ Storage
✔ Laravel Notifications provide a simple, expressive API for sending
notifications across a variety of delivery channels such as email, Slack,
SMS
Request Lifecycle
✔ The entry point for all requests to a Laravel application is the
public/index.php file
✔ Index.php loads Composer generated autoloader definition then
retreives instance of bootstrap/app.php script.
✔ The incoming request is sent to kernel (HTTP/console) which contains
bootstrappers (These bootstrappers configure error handling, configure
logging, detect the application environment). It contains all middlewares
as well.
✔ One of the most important Kernel bootstrapping actions is loading the
service providers for your application.
Thanks
By
Swapnil Tripathi

More Related Content

What's hot

Getting to know Laravel 5
Getting to know Laravel 5Getting to know Laravel 5
Getting to know Laravel 5Bukhori Aqid
 
Flask Introduction - Python Meetup
Flask Introduction - Python MeetupFlask Introduction - Python Meetup
Flask Introduction - Python MeetupAreski Belaid
 
Laravel Beginners Tutorial 1
Laravel Beginners Tutorial 1Laravel Beginners Tutorial 1
Laravel Beginners Tutorial 1Vikas Chauhan
 
Introduction to laravel framework
Introduction to laravel frameworkIntroduction to laravel framework
Introduction to laravel frameworkAhmad Fatoni
 
Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5Elena Kolevska
 
Designing CakePHP plugins for consuming APIs
Designing CakePHP plugins for consuming APIsDesigning CakePHP plugins for consuming APIs
Designing CakePHP plugins for consuming APIsNeil Crookes
 
Laravel Beginners Tutorial 2
Laravel Beginners Tutorial 2Laravel Beginners Tutorial 2
Laravel Beginners Tutorial 2Vikas Chauhan
 
Introduction to Laravel Framework (5.2)
Introduction to Laravel Framework (5.2)Introduction to Laravel Framework (5.2)
Introduction to Laravel Framework (5.2)Viral Solani
 
Laravel 5 In Depth
Laravel 5 In DepthLaravel 5 In Depth
Laravel 5 In DepthKirk Bushell
 
Things to keep in mind while creating a word press plugin from scratch
Things to keep in mind while creating a word press plugin from scratchThings to keep in mind while creating a word press plugin from scratch
Things to keep in mind while creating a word press plugin from scratchElsner Technologies Pvt Ltd
 
Laravel for Web Artisans
Laravel for Web ArtisansLaravel for Web Artisans
Laravel for Web ArtisansRaf Kewl
 

What's hot (20)

Getting to know Laravel 5
Getting to know Laravel 5Getting to know Laravel 5
Getting to know Laravel 5
 
Flask
FlaskFlask
Flask
 
Flask vs. Django
Flask vs. DjangoFlask vs. Django
Flask vs. Django
 
Presentation laravel 5 4
Presentation laravel 5 4Presentation laravel 5 4
Presentation laravel 5 4
 
Flask Introduction - Python Meetup
Flask Introduction - Python MeetupFlask Introduction - Python Meetup
Flask Introduction - Python Meetup
 
Intro to Laravel
Intro to LaravelIntro to Laravel
Intro to Laravel
 
Laravel Beginners Tutorial 1
Laravel Beginners Tutorial 1Laravel Beginners Tutorial 1
Laravel Beginners Tutorial 1
 
Introduction to laravel framework
Introduction to laravel frameworkIntroduction to laravel framework
Introduction to laravel framework
 
Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5
 
Why Laravel?
Why Laravel?Why Laravel?
Why Laravel?
 
Designing CakePHP plugins for consuming APIs
Designing CakePHP plugins for consuming APIsDesigning CakePHP plugins for consuming APIs
Designing CakePHP plugins for consuming APIs
 
Laravel Beginners Tutorial 2
Laravel Beginners Tutorial 2Laravel Beginners Tutorial 2
Laravel Beginners Tutorial 2
 
Introduction to Laravel Framework (5.2)
Introduction to Laravel Framework (5.2)Introduction to Laravel Framework (5.2)
Introduction to Laravel Framework (5.2)
 
Laravel 101
Laravel 101Laravel 101
Laravel 101
 
Laravel 5 In Depth
Laravel 5 In DepthLaravel 5 In Depth
Laravel 5 In Depth
 
Things to keep in mind while creating a word press plugin from scratch
Things to keep in mind while creating a word press plugin from scratchThings to keep in mind while creating a word press plugin from scratch
Things to keep in mind while creating a word press plugin from scratch
 
Apache
ApacheApache
Apache
 
MySQL Presentation
MySQL PresentationMySQL Presentation
MySQL Presentation
 
Workshop Laravel 5.2
Workshop Laravel 5.2Workshop Laravel 5.2
Workshop Laravel 5.2
 
Laravel for Web Artisans
Laravel for Web ArtisansLaravel for Web Artisans
Laravel for Web Artisans
 

Similar to Laravel 5.3 - Web Development Php framework

Laravel Starter Kit | Laravel Admin Template-ChandraAdmin
Laravel Starter Kit | Laravel Admin Template-ChandraAdmin Laravel Starter Kit | Laravel Admin Template-ChandraAdmin
Laravel Starter Kit | Laravel Admin Template-ChandraAdmin Lorvent56
 
Lecture 2_ Intro to laravel.pptx
Lecture 2_ Intro to laravel.pptxLecture 2_ Intro to laravel.pptx
Lecture 2_ Intro to laravel.pptxSaziaRahman
 
Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Laravel development (Laravel History, Environment Setup & Laravel Installatio...Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Laravel development (Laravel History, Environment Setup & Laravel Installatio...Dilouar Hossain
 
MidwestPHP 2016 - Adventures in Laravel 5
MidwestPHP 2016 - Adventures in Laravel 5 MidwestPHP 2016 - Adventures in Laravel 5
MidwestPHP 2016 - Adventures in Laravel 5 Joe Ferguson
 
Web Development with Laravel 5
Web Development with Laravel 5Web Development with Laravel 5
Web Development with Laravel 5Soheil Khodayari
 
Adventures in Laravel 5 SunshinePHP 2016 Tutorial
Adventures in Laravel 5 SunshinePHP 2016 TutorialAdventures in Laravel 5 SunshinePHP 2016 Tutorial
Adventures in Laravel 5 SunshinePHP 2016 TutorialJoe Ferguson
 
Laravel presentation
Laravel presentationLaravel presentation
Laravel presentationToufiq Mahmud
 
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
 
Getting started-with-zend-framework
Getting started-with-zend-frameworkGetting started-with-zend-framework
Getting started-with-zend-frameworkMarcelo da Rocha
 
Laravel & Composer presentation - extended
Laravel & Composer presentation - extendedLaravel & Composer presentation - extended
Laravel & Composer presentation - extendedCvetomir Denchev
 
Laravel 5 New Features
Laravel 5 New FeaturesLaravel 5 New Features
Laravel 5 New FeaturesJoe Ferguson
 
Lecture11_LaravelGetStarted_SPring2023.pdf
Lecture11_LaravelGetStarted_SPring2023.pdfLecture11_LaravelGetStarted_SPring2023.pdf
Lecture11_LaravelGetStarted_SPring2023.pdfShaimaaMohamedGalal
 
Laravel and artisan cli
Laravel and artisan cliLaravel and artisan cli
Laravel and artisan cliSayed Ahmed
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkBo-Yi Wu
 

Similar to Laravel 5.3 - Web Development Php framework (20)

Laravel Starter Kit | Laravel Admin Template-ChandraAdmin
Laravel Starter Kit | Laravel Admin Template-ChandraAdmin Laravel Starter Kit | Laravel Admin Template-ChandraAdmin
Laravel Starter Kit | Laravel Admin Template-ChandraAdmin
 
Lecture 2_ Intro to laravel.pptx
Lecture 2_ Intro to laravel.pptxLecture 2_ Intro to laravel.pptx
Lecture 2_ Intro to laravel.pptx
 
Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Laravel development (Laravel History, Environment Setup & Laravel Installatio...Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Laravel development (Laravel History, Environment Setup & Laravel Installatio...
 
MidwestPHP 2016 - Adventures in Laravel 5
MidwestPHP 2016 - Adventures in Laravel 5 MidwestPHP 2016 - Adventures in Laravel 5
MidwestPHP 2016 - Adventures in Laravel 5
 
Web Development with Laravel 5
Web Development with Laravel 5Web Development with Laravel 5
Web Development with Laravel 5
 
Adventures in Laravel 5 SunshinePHP 2016 Tutorial
Adventures in Laravel 5 SunshinePHP 2016 TutorialAdventures in Laravel 5 SunshinePHP 2016 Tutorial
Adventures in Laravel 5 SunshinePHP 2016 Tutorial
 
Laravel presentation
Laravel presentationLaravel presentation
Laravel presentation
 
Laravel
LaravelLaravel
Laravel
 
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)
 
Getting started-with-zend-framework
Getting started-with-zend-frameworkGetting started-with-zend-framework
Getting started-with-zend-framework
 
Getting started with laravel
Getting started with laravelGetting started with laravel
Getting started with laravel
 
Laravel & Composer presentation - extended
Laravel & Composer presentation - extendedLaravel & Composer presentation - extended
Laravel & Composer presentation - extended
 
Laravel overview
Laravel overviewLaravel overview
Laravel overview
 
Laravel 5 New Features
Laravel 5 New FeaturesLaravel 5 New Features
Laravel 5 New Features
 
Apache ppt
Apache pptApache ppt
Apache ppt
 
Lecture11_LaravelGetStarted_SPring2023.pdf
Lecture11_LaravelGetStarted_SPring2023.pdfLecture11_LaravelGetStarted_SPring2023.pdf
Lecture11_LaravelGetStarted_SPring2023.pdf
 
Apache
ApacheApache
Apache
 
Laravel and artisan cli
Laravel and artisan cliLaravel and artisan cli
Laravel and artisan cli
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC Framework
 
Apache - Quick reference guide
Apache - Quick reference guideApache - Quick reference guide
Apache - Quick reference guide
 

Recently uploaded

Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 

Laravel 5.3 - Web Development Php framework

  • 2. What's Laravel ? THE PHP FRAMEWORK FOR WEB ARTISANS. PHP THAT DOESN'T HURT. CODE HAPPY & ENJOY THE FRESH AIR.
  • 3. Where To Start From? Laravel is very flexible framwork. There are at least 3 options how to create new project: ✔ via laravel installer ✔ via composer ✔ clone from github
  • 4. Via Laravel Installer? This will download laravel installer via composer composer global require "laravel/installer" This simple command will create app laravel new blog
  • 5. Other Options Via composer composer create-project --prefer-dist laravel/laravel blog Get From github https://github.com/laravel/laravel
  • 6. Development Environment After installing Laravel, you should configure your web server's document / web root to be the public directory. The index.php in this directory serves as the front controller for all HTTP requests entering your application.
  • 7. Laravel and Composer ✔ Add/remove/update packages ✔ Dump autoload file and generate new one ✔ Update laravel version
  • 8. Laravel Directory Structure ✔ The app directory, as you might expect, contains the core code of your application. ✔ The bootstrap directory contains files that bootstrap the framework and configure autoloading. ✔ The config directory, as the name implies, contains all of your application's configuration files ✔ The database directory contains your database migration and seeds. ✔ The public directory contains the index.php file. ✔ The resources directory contains your views as well as your raw, un-compiled assets such as views.
  • 9. More Directories ✔ The routes directory contains all of the route definitions for your application. - The web.php file contains routes that the RouteServiceProvider places in the web middleware group, - The api.php file contains routes that the RouteServiceProvider places in the api middleware group, - The console.php file is where you may define all of your Closure based console commands. ✔ The storage directory contains your compiled Blade templates, file based sessions, file caches, and other files generated by the framework. ✔ The vendor directory contains your Composer dependencies.
  • 10. Magic Artisan Command line tool for web artisans php artisan list Basically artisan is a php script which performs all actions in Laravel for example: ✔ Manage migrations ✔ Check application routes ✔ Clear app cache ✔ Create Artisan command ✔ Run database seeds
  • 11. Laravel And Namespaces Laravel actively uses php namespaces to keep classnames short and keep possibility to use same class names for different components. I would suggest everyone to use namespaces too. For example all Admin functionality under Admin namespace.
  • 12. Laravel Routes Route::get('foo', callback); Route::get('/welcome/{name?}', function($name = null){ return 'Name comes from paramatere >> '.$name; })->where('name', '[A-Za-z]+'); Route::group(['prefix' => 'name'], function () { Route::get('/user/profile', function () { return 'name with profile.'; }); });
  • 14. Laravel Middlewares Before / After Middleware ✔ Middleware provide a convenient mechanism for filtering HTTP requests entering your application. ✔ php artisan make:middleware CheckAge ✔ Location of create middleware app/Http/Middleware ✔ If you want a middleware to run during every HTTP request to your application, simply list the middleware class in the $middleware property of your app/Http/Kernel.php class.
  • 15. Laravel Controllers php artisan make:controller newController –resource There’s one main Controller class which all controllers should extend. By default Laravel has BaseController (extends from Controller) and HomeController (extends from BaseController) class UserController extends Controller{ public function __construct(){ $this->middleware('auth'); } }
  • 16. Talking About Views ✔ All views are located in app/views directory ✔ Can be separated in subdirectories ✔ Can be both blade or simple php files ✔ It is recommended to use balde template engine since it is very convenient and helps to eliminate random logic blocks in views ✔ View::make(‘user.profile’, $data)
  • 17. Insights In Blade Comments {{-- Comment visible only in blade file --}} Loops: @forelse($users as $user) <li>{{ $user->name }}</li> @empty <p>No users</p> @endforelse Conditions: @unless (Auth::check()) // similar to if(!) You are not signed in. @endunless
  • 18. Models ✔ Models are located under app/ directory. ✔ php artisan make:model Userkelltontech. ✔ Table convention is "snake cased" flights for Flight Model. ✔ Protect mass update protected $fillable = ['name'];/ guarded ✔ AppFlight::findOrFail(1); ✔ FindOrFail(1); ✔ Flight::popular()->women()->orderBy('created_at')->get(); Enable soft Delete ✔ Add deleted_at ✔ use IlluminateDatabaseEloquentSoftDeletes; ✔ Use trait SoftDeletes;
  • 19. Laravel Migrations ✔ php artisan make:migration create_users_table –create=flights ✔ Each migration has two functions up and down to migrate and rollback $table->increments('id'); $table->string('name', 255); $table->string('email', 255); $table->integer('nerd_level'); $table->timestamps();
  • 20. Useful General Modules ✔ Queue ✔ Events File ✔ Storage ✔ Laravel Notifications provide a simple, expressive API for sending notifications across a variety of delivery channels such as email, Slack, SMS
  • 21. Request Lifecycle ✔ The entry point for all requests to a Laravel application is the public/index.php file ✔ Index.php loads Composer generated autoloader definition then retreives instance of bootstrap/app.php script. ✔ The incoming request is sent to kernel (HTTP/console) which contains bootstrappers (These bootstrappers configure error handling, configure logging, detect the application environment). It contains all middlewares as well. ✔ One of the most important Kernel bootstrapping actions is loading the service providers for your application.