SlideShare una empresa de Scribd logo
1 de 60
To My Presentation on
Laravel Development
Introduction
Muhammad Mahdi Hasan
 B.Sc. in Computer Science & Engineering
from International University of Business
Agriculture & Technology
 Currently working as a laravel developer in
Creative Software Ltd.
1st part
I. Laravel History, Environment Setup & Laravel
Installation
II. MVC architecture, Basic Authentication & Routing
III. Laravel Template Mastering & CRUD Operation
IV. Laravel Role Implementation, File storage &
Middleware
V. Eloquent ORM & Query Builder, Cart, Session &
Others
Content
 Implement laravel project & database connection
 Know how MCV architecture pattern works
 Know how to create, read, update & delete data
from MySql database with laravel project
 Basic authentication & role implementation
 Laravel project upload online demo
Our Goals
Laravel History,
Environment Setup
&
Laravel Installation
Laravel is a free, open-source PHP web
framework, created by Taylor Otwell and
intended for the development of web
applications following the model–view–
controller (MVC) architectural pattern.
What Is Laravel ?
Developer(s) Taylor Otwell
Initial release June 2011; 8 years ago
[1]
Stable release 6.9.0
[2]
/ 2019-12-19[±]
Written in PHP
Type Web framework
License MIT License
Website laravel.com
• The source code of Laravel is hosted on
GitHub and licensed under the terms of MIT
License.
History
Taylor Otwell created Laravel as an attempt to
provide a more advanced alternative to the
CodeIgniter framework, which did not provide certain
features such as built-in support for user
authentication and authorization. Laravel's first beta
release was made available on June 9, 2011,
followed by the Laravel 1 release later in the same
month.
Why Should We Choose
Laravel?
 Authorization Technique
 Object-Oriented Libraries
 Artisan
 MVC Support
 Security
 Database Migration
 Great Tutorials (Laracasts)
 Blade Templating Engine
 Responsible Interface
 Automatic Package Discovery
Installing
Laravel
Installation
Server Requirements
Install Composer
Install Laravel
Configuration
 PHP >= 7.2.0
 BCMath PHP Extension
 Ctype PHP Extension
 JSON PHP Extension
 Mbstring PHP Extension
 OpenSSL PHP Extension
 PDO PHP Extension
 Tokenizer PHP Extension
 XML PHP Extension
Server Requirements
Installing Composer
Laravel utilizes Composer to manage its
dependencies. So, before using Laravel,
make sure you have Composer installed
on your machine.
Installing Laravel
There Are 2 ways to install laravel project:
• Via Laravel Installer
• Via Composer Create-Project
• Via Laravel Installer
First, download the Laravel installer using Composer
than :
composer global require laravel/installer
laravel new blog
• Via Composer Create-Project
Alternatively, you may also install Laravel by issuing
the Composer create-project command in your
terminal:
composer create-project --prefer-dist laravel/laravel blog
• Note
Above commands will install the latest versions of laravel so if
you want to specify a version, you can use composer:
composer create-project laravel/laravel=5.8 myapp
Configuration
Public Directory
Configuration Files
Directory Permissions
Application Key
Additional Configuration
1st part End
2nd part
MVC architecture,
Basic Authentication
&
Routing
What Is MVC ?
The Model-View-Controller (MVC) is an
architectural pattern that separates an
application into three main logical
components: the model, the view, and the
controller. Each of these components are
built to handle specific development aspects
of an application. MVC is one of the most
frequently used industry-standard web
development framework to create scalable
and extensible projects.
Basic Authentication
Install the laravel/ui Composer package and run
php artisan ui vue --auth in a fresh Laravel
application. After migrating your database, navigate
your browser to http://your-app.test/register or any
other URL that is assigned to your application.
These commands will take care of scaffolding your
entire authentication system!
In laravel, there are 2 routes file web.php and api.php.
 web.php file is used for registering all the web
routes like -
mywebsite.com/about
or
mywebsite.com/contact
 api.php is used for registering all the routes related
to an api. We are only using web routes so don’t
worry about any api routes.
Routing
 Route:
Route::get('/', function () { return view('welcome'); });
Route::post('/product-create', 'ProductController@create')
->name('productcreate');
Route::get('/product-index','ProductController@index')->name('productindex');
Route::post('/product-update', 'ProductController@update')
->name('productupdate');
Route::get('/product-edit', 'ProductController@edit')->name('productedit');
Route::get('/product-delete', 'ProductController@delete')
->name('productdelete');
Laravel Project
Structure
app −This directory contains the core code of the
application.
bootstrap −This directory contains the application
bootstrapping script.
config −This directory contains configuration files of
application.
database −This folder contains your database migration and
seeds.
public −This is the application’s document root. It starts the
Laravel application. It also contains the assets of the
application like JavaScript, CSS, Images, etc.
resources −This directory contains raw assets such as the
LESS & Sass files, localization and language files, and
Templates that are rendered as HTML.
storage −This directory contains App storage, like file
uploads etc. Framework storage (cache), and
application-generated logs.
test −This directory contains various test cases.
vendor −This directory contains composer dependencies.
2nd part End
3rd part
Template Mastering
&
CRUD Operation
Template Mastering
The Blade Master Template is where we can place all the
boilerplate that all pages will typically make use of. Most times
you can name this file something like master.blade.php. All
view files that you would like to have make use of your master
page can now use the @extends keyword to do so. Since our
master page has the name of master.blade.php, in our view
files we will use @extends('master'). You can name the
master page something else if you want to, you’ll just need to
make sure to extend the other name. For example if your
master page is default.blade.php, you can use
@extends(‘default‘) in your view files.
CRUD Operation
$ php artisan make:model Product
protected $fillable = [ 'field_1', 'field_2', ‘field_3‘ ];
Migration :
Schema::create('products', function (Blueprint $table)
{
$table->increments('id');
$table->string('field_1');
$table->text('field_2');
$table->integer(field_3');
$table->timestamps();
});
$ php artisan migrate
$ php artisan make:migration create_products_table
Model :
$ php artisan make:controller ProductController
public function index()
{
return view('product_index');
}
public function create()
{
$data = new Product ();
$data->field_1 = $request->field_1;
$data->field_2 = $request->field_2;
$data->field_3 = $request->field_3;
$data->save();
return redirect('/products');
}
Controllers :
public function edit($id)
{
$product = Product::find($id);
return response()->json($product);
}
public function update()
{
$data = Product::find($request->id);
$data->field_1 = $request->field_1;
$data->field_2 = $request->field_2;
$data->field_3 = $request->field_3;
$data->save();
return redirect()->back();
}
Controllers :
Controllers :
public function delete($id)
{
$product = Product::find($id);
$product->delete();
return redirect()->back();
}
3rd part End
4th part
Role
Implementation,
File storage
& Middleware
In many web projects, we have different user roles
interacting with the system. Each role has its own
permission. Every feature of the system can be enabled
or disabled for these roles. We can define users
permissions in our codes and check if they are
authorized to do the requested action or not. A better
way, mostly in more flexible systems, is to create a role
and authorization management system. I’ll explain how
to implement a Laravel authorization system and define
users permission based on their roles.
Implementing User Roles into a Laravel Application. User
Roles allow us to control access to a page or feature within
an application.
Role Implementation
Gate:
Gates are Closures that determine if a user is authorized to
perform a given action and are typically defined in the App
Providers AuthServiceProvider class using the Gate facade.
public function boot(GateContract $gate)
{
$this->registerPolicies($gate);
$gate->define('isAdmin', function($user)
{
return $user->user_type == '0';
});
$gate->define('isCompany', function($user)
{
return $user->user_type == '3';
});
$gate->define('isUser', function($user)
{
return $user->user_type == '1';
});
}
Store a File
$this->validate($request,[ 'image'=> 'required|image|mimes:jpeg,png,jpg|' ]);
if ($request->hasFile('image'))
{
$image = $request->file('image');
$imagename = uniqid().$image->getClientOriginalName();
$uploadPath = 'public/Product/';
$image->move($uploadPath,$imagename);
$imageUrl = $uploadPath.$imagename;
}
else { $imageUrl = null; }
$post = new Product();
$post->title = $request->name;
$post->image = $imageUrl;
$post->save();
return redirect()->back();
Middleware provide a convenient mechanism for
filtering HTTP requests entering your application.
For example, Laravel includes a middleware that
verifies the user of your application is authenticated.
If the user is not authenticated, the middleware will
redirect the user to the login screen. However, if the
user is authenticated, the middleware will allow the
request to proceed further into the application.
Middleware
4th part End
5th part
Eloquent ORM
&
Query Builder
The Eloquent ORM included with Laravel
provides a beautiful, simple Active Record
implementation for working with your
database. Each database table has a
corresponding "Model" which is used to
interact with that table. Models allow you to
query for data in your tables, as well as
insert new records into the table.
Eloquent ORM
Laravel's database query builder provides a
convenient, fluent interface to creating and
running database queries. It can be used to
perform most database operations in your
application and works on all supported
database systems.
Query Builder
Cart, Session
&
Others
Laravel Shopping cart
Run the Composer require command from the Terminal:
composer require gloudemans/shoppingcart
GloudemansShoppingcartShoppingcartServiceProvider::class
'Cart' => GloudemansShoppingcartFacadesCart::class,
Check & and optionally add a new line to the aliases array:
Check & add a new line to the providers array:
Gloudemans Shoppingcart is a simple shoppingcart
implementation for Laravel.
public function addtocart(Request $request)
{
$products=Product::find($request->id);
Cart::add([
'id'=>$request->id,
'qty'=>$request->qty,
'name'=>$products->productname,
'price'=>$products->price,
'options' =>
[ 'image' => $products->image ]
]);
return back()->withInput();
}
public function cartshow()
{ $cartProduct = Cart::content();
$cartCount = Cart::count();
return view(‘ViewPage',compact(‘cartProduct’,‘cartCount’);
}
public function update(Request $request)
{
Cart::update($request->rowId, $request->qty);
return redirect()->back();
}
public function delete($id)
{
Cart::remove($id);
return redirect()->back();
}
Cart::destroy();
Cart::total();
Cart::subtotal();
Cart::count();
Session
Since HTTP driven applications are stateless, sessions provide a way to
store information about the user across multiple requests. Laravel ships
with a variety of session backends that are accessed through an
expressive, unified API. Support for popular backends such as
Memcached, Redis, and databases is included out of the box.
The session configuration file is stored at config/session.php. Be sure to
review the options available to you in this file.
@if(session(‘message'))
<div class="alert alert-dismissible alert-success">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>{{ session(‘message') }}</strong>
</div>
@endif
5th part End
References :
 https://laravel.com/
 https://en.wikipedia.org/wiki/Laravel/
 https://laracasts.com/
 https://medium.com/techcompose/
 https://github.com/Crinsane/LaravelShoppingcart
 https://blog.pusher.com/laravel-mvc-use/
 https://getcomposer.org/download/
 https://laravel.com/docs/5.8/authentication
 https://www.tutorialspoint.com/laravel/index.htm
Laravel development (Laravel History, Environment Setup & Laravel Installation MVC architecture, Basic Authentication)
Laravel development (Laravel History, Environment Setup & Laravel Installation MVC architecture, Basic Authentication)

Más contenido relacionado

La actualidad más candente

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 ArtisansWindzoon Technologies
 
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 ProjectsSam Dias
 
Laravel tutorial
Laravel tutorialLaravel tutorial
Laravel tutorialBroker IG
 
Object Oriented Programming with Laravel - Session 1
Object Oriented Programming with Laravel - Session 1Object Oriented Programming with Laravel - Session 1
Object Oriented Programming with Laravel - Session 1Shahrzad Peyman
 
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 4Untung D Saptoto
 
Lecture 2_ Intro to laravel.pptx
Lecture 2_ Intro to laravel.pptxLecture 2_ Intro to laravel.pptx
Lecture 2_ Intro to laravel.pptxSaziaRahman
 
REST API and CRUD
REST API and CRUDREST API and CRUD
REST API and CRUDPrem Sanil
 
Object Oriented Programming with Laravel - Session 3
Object Oriented Programming with Laravel - Session 3Object Oriented Programming with Laravel - Session 3
Object Oriented Programming with Laravel - Session 3Shahrzad Peyman
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event HandlingWebStackAcademy
 

La actualidad más candente (20)

Laravel Tutorial PPT
Laravel Tutorial PPTLaravel Tutorial PPT
Laravel Tutorial 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
 
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 tutorial
Laravel tutorialLaravel tutorial
Laravel tutorial
 
Laravel
LaravelLaravel
Laravel
 
Laravel Introduction
Laravel IntroductionLaravel Introduction
Laravel Introduction
 
Laravel ppt
Laravel pptLaravel ppt
Laravel ppt
 
Laravel
LaravelLaravel
Laravel
 
Laravel 101
Laravel 101Laravel 101
Laravel 101
 
Object Oriented Programming with Laravel - Session 1
Object Oriented Programming with Laravel - Session 1Object Oriented Programming with Laravel - Session 1
Object Oriented Programming with Laravel - Session 1
 
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
Spring bootSpring boot
Spring boot
 
Lecture 2_ Intro to laravel.pptx
Lecture 2_ Intro to laravel.pptxLecture 2_ Intro to laravel.pptx
Lecture 2_ Intro to laravel.pptx
 
REST API and CRUD
REST API and CRUDREST API and CRUD
REST API and CRUD
 
Laravel Blade Template
Laravel Blade TemplateLaravel Blade Template
Laravel Blade Template
 
ReactJS presentation.pptx
ReactJS presentation.pptxReactJS presentation.pptx
ReactJS presentation.pptx
 
Object Oriented Programming with Laravel - Session 3
Object Oriented Programming with Laravel - Session 3Object Oriented Programming with Laravel - Session 3
Object Oriented Programming with Laravel - Session 3
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event Handling
 
Expressjs
ExpressjsExpressjs
Expressjs
 
MVC in PHP
MVC in PHPMVC in PHP
MVC in PHP
 

Similar a Laravel development (Laravel History, Environment Setup & Laravel Installation MVC architecture, Basic Authentication)

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
 
laravel-interview-questions.pdf
laravel-interview-questions.pdflaravel-interview-questions.pdf
laravel-interview-questions.pdfAnuragMourya8
 
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 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
 
Web services with laravel
Web services with laravelWeb services with laravel
Web services with laravelConfiz
 
Laravel & Composer presentation - extended
Laravel & Composer presentation - extendedLaravel & Composer presentation - extended
Laravel & Composer presentation - extendedCvetomir Denchev
 
Web service with Laravel
Web service with LaravelWeb service with Laravel
Web service with LaravelAbuzer Firdousi
 
RESTful API development in Laravel 4 - Christopher Pecoraro
RESTful API development in Laravel 4 - Christopher PecoraroRESTful API development in Laravel 4 - Christopher Pecoraro
RESTful API development in Laravel 4 - Christopher PecoraroChristopher Pecoraro
 
Laravel & Composer presentation - WebHostFace
Laravel & Composer presentation - WebHostFace Laravel & Composer presentation - WebHostFace
Laravel & Composer presentation - WebHostFace Cvetomir Denchev
 
Building Scalable Applications with Laravel
Building Scalable Applications with LaravelBuilding Scalable Applications with Laravel
Building Scalable Applications with LaravelMuhammad Shakeel
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkBo-Yi Wu
 
A introduction to Laravel framework
A introduction to Laravel frameworkA introduction to Laravel framework
A introduction to Laravel frameworkPhu Luong Trong
 
Laravel 5 New Features
Laravel 5 New FeaturesLaravel 5 New Features
Laravel 5 New FeaturesJoe Ferguson
 
Create Home Directories on Storage Using WFA and ServiceNow integration
Create Home Directories on Storage Using WFA and ServiceNow integrationCreate Home Directories on Storage Using WFA and ServiceNow integration
Create Home Directories on Storage Using WFA and ServiceNow integrationRutul Shah
 
Exploring Symfony's Code
Exploring Symfony's CodeExploring Symfony's Code
Exploring Symfony's CodeWildan Maulana
 

Similar a Laravel development (Laravel History, Environment Setup & Laravel Installation MVC architecture, Basic Authentication) (20)

MidwestPHP 2016 - Adventures in Laravel 5
MidwestPHP 2016 - Adventures in Laravel 5 MidwestPHP 2016 - Adventures in Laravel 5
MidwestPHP 2016 - Adventures in Laravel 5
 
Laravel 5
Laravel 5Laravel 5
Laravel 5
 
laravel-interview-questions.pdf
laravel-interview-questions.pdflaravel-interview-questions.pdf
laravel-interview-questions.pdf
 
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 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
 
Web services with laravel
Web services with laravelWeb services with laravel
Web services with laravel
 
Intro to Laravel 4
Intro to Laravel 4Intro to Laravel 4
Intro to Laravel 4
 
Laravel & Composer presentation - extended
Laravel & Composer presentation - extendedLaravel & Composer presentation - extended
Laravel & Composer presentation - extended
 
Workshop Laravel 5.2
Workshop Laravel 5.2Workshop Laravel 5.2
Workshop Laravel 5.2
 
Web service with Laravel
Web service with LaravelWeb service with Laravel
Web service with Laravel
 
RESTful API development in Laravel 4 - Christopher Pecoraro
RESTful API development in Laravel 4 - Christopher PecoraroRESTful API development in Laravel 4 - Christopher Pecoraro
RESTful API development in Laravel 4 - Christopher Pecoraro
 
Laravel & Composer presentation - WebHostFace
Laravel & Composer presentation - WebHostFace Laravel & Composer presentation - WebHostFace
Laravel & Composer presentation - WebHostFace
 
Building Scalable Applications with Laravel
Building Scalable Applications with LaravelBuilding Scalable Applications with Laravel
Building Scalable Applications with Laravel
 
Laravel tips-2019-04
Laravel tips-2019-04Laravel tips-2019-04
Laravel tips-2019-04
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC Framework
 
A introduction to Laravel framework
A introduction to Laravel frameworkA introduction to Laravel framework
A introduction to Laravel framework
 
Laravel 5 New Features
Laravel 5 New FeaturesLaravel 5 New Features
Laravel 5 New Features
 
Laravel 5.3 - Web Development Php framework
Laravel 5.3 - Web Development Php frameworkLaravel 5.3 - Web Development Php framework
Laravel 5.3 - Web Development Php framework
 
Create Home Directories on Storage Using WFA and ServiceNow integration
Create Home Directories on Storage Using WFA and ServiceNow integrationCreate Home Directories on Storage Using WFA and ServiceNow integration
Create Home Directories on Storage Using WFA and ServiceNow integration
 
Exploring Symfony's Code
Exploring Symfony's CodeExploring Symfony's Code
Exploring Symfony's Code
 

Más de Dilouar Hossain

Digital Marketing Trainer Interview Overview.pptx
Digital Marketing Trainer Interview Overview.pptxDigital Marketing Trainer Interview Overview.pptx
Digital Marketing Trainer Interview Overview.pptxDilouar Hossain
 
Future lab institute plan
Future lab institute planFuture lab institute plan
Future lab institute planDilouar Hossain
 
Welcome to our presentation
Welcome to our presentationWelcome to our presentation
Welcome to our presentationDilouar Hossain
 
Pharmacy management software presentation overview
Pharmacy management software presentation overviewPharmacy management software presentation overview
Pharmacy management software presentation overviewDilouar Hossain
 
Training overview on digital marketing
Training overview on digital marketingTraining overview on digital marketing
Training overview on digital marketingDilouar Hossain
 
How to work zoom meeting apps | zoom cloud meetings
How to work zoom meeting apps | zoom cloud meetingsHow to work zoom meeting apps | zoom cloud meetings
How to work zoom meeting apps | zoom cloud meetingsDilouar Hossain
 
Digital marketing Tips (Facebook, Linkedin, Twitter Marketing)
Digital marketing Tips (Facebook, Linkedin, Twitter Marketing)Digital marketing Tips (Facebook, Linkedin, Twitter Marketing)
Digital marketing Tips (Facebook, Linkedin, Twitter Marketing)Dilouar Hossain
 
Web development (Wordpress)
Web development (Wordpress)Web development (Wordpress)
Web development (Wordpress)Dilouar Hossain
 
Internship Training overview
Internship Training overviewInternship Training overview
Internship Training overviewDilouar Hossain
 
My life style of Dilouar Hossain
My life style of Dilouar HossainMy life style of Dilouar Hossain
My life style of Dilouar HossainDilouar Hossain
 
Career guideline for freelancers By Dilouar Hossain
Career guideline for freelancers By Dilouar HossainCareer guideline for freelancers By Dilouar Hossain
Career guideline for freelancers By Dilouar HossainDilouar Hossain
 
Welcome to creative Software in Bangladesh
Welcome to creative Software in BangladeshWelcome to creative Software in Bangladesh
Welcome to creative Software in BangladeshDilouar Hossain
 
Regular expressions and languages pdf
Regular expressions and languages pdfRegular expressions and languages pdf
Regular expressions and languages pdfDilouar Hossain
 
Two phase commit protocol in dbms
Two phase commit protocol in dbmsTwo phase commit protocol in dbms
Two phase commit protocol in dbmsDilouar Hossain
 
High pass filter with analog electronic
High pass filter with analog electronicHigh pass filter with analog electronic
High pass filter with analog electronicDilouar Hossain
 
Dc generator with machine 2
Dc generator with machine 2Dc generator with machine 2
Dc generator with machine 2Dilouar Hossain
 
Dc generator with machine 2
Dc generator with machine 2Dc generator with machine 2
Dc generator with machine 2Dilouar Hossain
 

Más de Dilouar Hossain (20)

Digital Marketing Trainer Interview Overview.pptx
Digital Marketing Trainer Interview Overview.pptxDigital Marketing Trainer Interview Overview.pptx
Digital Marketing Trainer Interview Overview.pptx
 
Future lab institute plan
Future lab institute planFuture lab institute plan
Future lab institute plan
 
Welcome to our presentation
Welcome to our presentationWelcome to our presentation
Welcome to our presentation
 
Pharmacy management software presentation overview
Pharmacy management software presentation overviewPharmacy management software presentation overview
Pharmacy management software presentation overview
 
Training overview on digital marketing
Training overview on digital marketingTraining overview on digital marketing
Training overview on digital marketing
 
How to work zoom meeting apps | zoom cloud meetings
How to work zoom meeting apps | zoom cloud meetingsHow to work zoom meeting apps | zoom cloud meetings
How to work zoom meeting apps | zoom cloud meetings
 
Digital marketing Tips (Facebook, Linkedin, Twitter Marketing)
Digital marketing Tips (Facebook, Linkedin, Twitter Marketing)Digital marketing Tips (Facebook, Linkedin, Twitter Marketing)
Digital marketing Tips (Facebook, Linkedin, Twitter Marketing)
 
Web development (Wordpress)
Web development (Wordpress)Web development (Wordpress)
Web development (Wordpress)
 
Internship Training overview
Internship Training overviewInternship Training overview
Internship Training overview
 
My life style of Dilouar Hossain
My life style of Dilouar HossainMy life style of Dilouar Hossain
My life style of Dilouar Hossain
 
Career guideline for freelancers By Dilouar Hossain
Career guideline for freelancers By Dilouar HossainCareer guideline for freelancers By Dilouar Hossain
Career guideline for freelancers By Dilouar Hossain
 
Welcome to creative pos
Welcome to creative posWelcome to creative pos
Welcome to creative pos
 
Welcome to creative Software in Bangladesh
Welcome to creative Software in BangladeshWelcome to creative Software in Bangladesh
Welcome to creative Software in Bangladesh
 
Regular expressions and languages pdf
Regular expressions and languages pdfRegular expressions and languages pdf
Regular expressions and languages pdf
 
Theory of computing pdf
Theory of computing pdfTheory of computing pdf
Theory of computing pdf
 
Batch operating system
Batch operating system Batch operating system
Batch operating system
 
Two phase commit protocol in dbms
Two phase commit protocol in dbmsTwo phase commit protocol in dbms
Two phase commit protocol in dbms
 
High pass filter with analog electronic
High pass filter with analog electronicHigh pass filter with analog electronic
High pass filter with analog electronic
 
Dc generator with machine 2
Dc generator with machine 2Dc generator with machine 2
Dc generator with machine 2
 
Dc generator with machine 2
Dc generator with machine 2Dc generator with machine 2
Dc generator with machine 2
 

Último

Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 

Último (20)

Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 

Laravel development (Laravel History, Environment Setup & Laravel Installation MVC architecture, Basic Authentication)

  • 1. To My Presentation on Laravel Development
  • 2. Introduction Muhammad Mahdi Hasan  B.Sc. in Computer Science & Engineering from International University of Business Agriculture & Technology  Currently working as a laravel developer in Creative Software Ltd.
  • 4. I. Laravel History, Environment Setup & Laravel Installation II. MVC architecture, Basic Authentication & Routing III. Laravel Template Mastering & CRUD Operation IV. Laravel Role Implementation, File storage & Middleware V. Eloquent ORM & Query Builder, Cart, Session & Others Content
  • 5.  Implement laravel project & database connection  Know how MCV architecture pattern works  Know how to create, read, update & delete data from MySql database with laravel project  Basic authentication & role implementation  Laravel project upload online demo Our Goals
  • 7. Laravel is a free, open-source PHP web framework, created by Taylor Otwell and intended for the development of web applications following the model–view– controller (MVC) architectural pattern. What Is Laravel ?
  • 8. Developer(s) Taylor Otwell Initial release June 2011; 8 years ago [1] Stable release 6.9.0 [2] / 2019-12-19[±] Written in PHP Type Web framework License MIT License Website laravel.com • The source code of Laravel is hosted on GitHub and licensed under the terms of MIT License.
  • 9. History Taylor Otwell created Laravel as an attempt to provide a more advanced alternative to the CodeIgniter framework, which did not provide certain features such as built-in support for user authentication and authorization. Laravel's first beta release was made available on June 9, 2011, followed by the Laravel 1 release later in the same month.
  • 10.
  • 11. Why Should We Choose Laravel?  Authorization Technique  Object-Oriented Libraries  Artisan  MVC Support  Security  Database Migration  Great Tutorials (Laracasts)  Blade Templating Engine  Responsible Interface  Automatic Package Discovery
  • 14.  PHP >= 7.2.0  BCMath PHP Extension  Ctype PHP Extension  JSON PHP Extension  Mbstring PHP Extension  OpenSSL PHP Extension  PDO PHP Extension  Tokenizer PHP Extension  XML PHP Extension Server Requirements
  • 15. Installing Composer Laravel utilizes Composer to manage its dependencies. So, before using Laravel, make sure you have Composer installed on your machine.
  • 16. Installing Laravel There Are 2 ways to install laravel project: • Via Laravel Installer • Via Composer Create-Project
  • 17. • Via Laravel Installer First, download the Laravel installer using Composer than : composer global require laravel/installer laravel new blog • Via Composer Create-Project Alternatively, you may also install Laravel by issuing the Composer create-project command in your terminal: composer create-project --prefer-dist laravel/laravel blog • Note Above commands will install the latest versions of laravel so if you want to specify a version, you can use composer: composer create-project laravel/laravel=5.8 myapp
  • 18. Configuration Public Directory Configuration Files Directory Permissions Application Key Additional Configuration
  • 23. The Model-View-Controller (MVC) is an architectural pattern that separates an application into three main logical components: the model, the view, and the controller. Each of these components are built to handle specific development aspects of an application. MVC is one of the most frequently used industry-standard web development framework to create scalable and extensible projects.
  • 24.
  • 25. Basic Authentication Install the laravel/ui Composer package and run php artisan ui vue --auth in a fresh Laravel application. After migrating your database, navigate your browser to http://your-app.test/register or any other URL that is assigned to your application. These commands will take care of scaffolding your entire authentication system!
  • 26. In laravel, there are 2 routes file web.php and api.php.  web.php file is used for registering all the web routes like - mywebsite.com/about or mywebsite.com/contact  api.php is used for registering all the routes related to an api. We are only using web routes so don’t worry about any api routes. Routing
  • 27.  Route: Route::get('/', function () { return view('welcome'); }); Route::post('/product-create', 'ProductController@create') ->name('productcreate'); Route::get('/product-index','ProductController@index')->name('productindex'); Route::post('/product-update', 'ProductController@update') ->name('productupdate'); Route::get('/product-edit', 'ProductController@edit')->name('productedit'); Route::get('/product-delete', 'ProductController@delete') ->name('productdelete');
  • 29. app −This directory contains the core code of the application. bootstrap −This directory contains the application bootstrapping script. config −This directory contains configuration files of application. database −This folder contains your database migration and seeds. public −This is the application’s document root. It starts the Laravel application. It also contains the assets of the application like JavaScript, CSS, Images, etc.
  • 30. resources −This directory contains raw assets such as the LESS & Sass files, localization and language files, and Templates that are rendered as HTML. storage −This directory contains App storage, like file uploads etc. Framework storage (cache), and application-generated logs. test −This directory contains various test cases. vendor −This directory contains composer dependencies.
  • 34. Template Mastering The Blade Master Template is where we can place all the boilerplate that all pages will typically make use of. Most times you can name this file something like master.blade.php. All view files that you would like to have make use of your master page can now use the @extends keyword to do so. Since our master page has the name of master.blade.php, in our view files we will use @extends('master'). You can name the master page something else if you want to, you’ll just need to make sure to extend the other name. For example if your master page is default.blade.php, you can use @extends(‘default‘) in your view files.
  • 36. $ php artisan make:model Product protected $fillable = [ 'field_1', 'field_2', ‘field_3‘ ]; Migration : Schema::create('products', function (Blueprint $table) { $table->increments('id'); $table->string('field_1'); $table->text('field_2'); $table->integer(field_3'); $table->timestamps(); }); $ php artisan migrate $ php artisan make:migration create_products_table Model :
  • 37. $ php artisan make:controller ProductController public function index() { return view('product_index'); } public function create() { $data = new Product (); $data->field_1 = $request->field_1; $data->field_2 = $request->field_2; $data->field_3 = $request->field_3; $data->save(); return redirect('/products'); } Controllers :
  • 38. public function edit($id) { $product = Product::find($id); return response()->json($product); } public function update() { $data = Product::find($request->id); $data->field_1 = $request->field_1; $data->field_2 = $request->field_2; $data->field_3 = $request->field_3; $data->save(); return redirect()->back(); } Controllers :
  • 39. Controllers : public function delete($id) { $product = Product::find($id); $product->delete(); return redirect()->back(); }
  • 43. In many web projects, we have different user roles interacting with the system. Each role has its own permission. Every feature of the system can be enabled or disabled for these roles. We can define users permissions in our codes and check if they are authorized to do the requested action or not. A better way, mostly in more flexible systems, is to create a role and authorization management system. I’ll explain how to implement a Laravel authorization system and define users permission based on their roles. Implementing User Roles into a Laravel Application. User Roles allow us to control access to a page or feature within an application. Role Implementation
  • 44. Gate: Gates are Closures that determine if a user is authorized to perform a given action and are typically defined in the App Providers AuthServiceProvider class using the Gate facade. public function boot(GateContract $gate) { $this->registerPolicies($gate); $gate->define('isAdmin', function($user) { return $user->user_type == '0'; }); $gate->define('isCompany', function($user) { return $user->user_type == '3'; }); $gate->define('isUser', function($user) { return $user->user_type == '1'; }); }
  • 45. Store a File $this->validate($request,[ 'image'=> 'required|image|mimes:jpeg,png,jpg|' ]); if ($request->hasFile('image')) { $image = $request->file('image'); $imagename = uniqid().$image->getClientOriginalName(); $uploadPath = 'public/Product/'; $image->move($uploadPath,$imagename); $imageUrl = $uploadPath.$imagename; } else { $imageUrl = null; } $post = new Product(); $post->title = $request->name; $post->image = $imageUrl; $post->save(); return redirect()->back();
  • 46. Middleware provide a convenient mechanism for filtering HTTP requests entering your application. For example, Laravel includes a middleware that verifies the user of your application is authenticated. If the user is not authenticated, the middleware will redirect the user to the login screen. However, if the user is authenticated, the middleware will allow the request to proceed further into the application. Middleware
  • 50. The Eloquent ORM included with Laravel provides a beautiful, simple Active Record implementation for working with your database. Each database table has a corresponding "Model" which is used to interact with that table. Models allow you to query for data in your tables, as well as insert new records into the table. Eloquent ORM
  • 51. Laravel's database query builder provides a convenient, fluent interface to creating and running database queries. It can be used to perform most database operations in your application and works on all supported database systems. Query Builder
  • 53. Laravel Shopping cart Run the Composer require command from the Terminal: composer require gloudemans/shoppingcart GloudemansShoppingcartShoppingcartServiceProvider::class 'Cart' => GloudemansShoppingcartFacadesCart::class, Check & and optionally add a new line to the aliases array: Check & add a new line to the providers array: Gloudemans Shoppingcart is a simple shoppingcart implementation for Laravel.
  • 54. public function addtocart(Request $request) { $products=Product::find($request->id); Cart::add([ 'id'=>$request->id, 'qty'=>$request->qty, 'name'=>$products->productname, 'price'=>$products->price, 'options' => [ 'image' => $products->image ] ]); return back()->withInput(); } public function cartshow() { $cartProduct = Cart::content(); $cartCount = Cart::count(); return view(‘ViewPage',compact(‘cartProduct’,‘cartCount’); }
  • 55. public function update(Request $request) { Cart::update($request->rowId, $request->qty); return redirect()->back(); } public function delete($id) { Cart::remove($id); return redirect()->back(); } Cart::destroy(); Cart::total(); Cart::subtotal(); Cart::count();
  • 56. Session Since HTTP driven applications are stateless, sessions provide a way to store information about the user across multiple requests. Laravel ships with a variety of session backends that are accessed through an expressive, unified API. Support for popular backends such as Memcached, Redis, and databases is included out of the box. The session configuration file is stored at config/session.php. Be sure to review the options available to you in this file. @if(session(‘message')) <div class="alert alert-dismissible alert-success"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>{{ session(‘message') }}</strong> </div> @endif
  • 58. References :  https://laravel.com/  https://en.wikipedia.org/wiki/Laravel/  https://laracasts.com/  https://medium.com/techcompose/  https://github.com/Crinsane/LaravelShoppingcart  https://blog.pusher.com/laravel-mvc-use/  https://getcomposer.org/download/  https://laravel.com/docs/5.8/authentication  https://www.tutorialspoint.com/laravel/index.htm