0% found this document useful (0 votes)
19 views11 pages

Detailed Laravel Lesson 2 3 SE331

Laravel is a PHP web framework that follows the MVC architecture, designed for building scalable web applications. It simplifies various tasks such as routing, database access, and authentication, and includes features like the Blade templating engine and Eloquent ORM for database interactions. The document also covers installation, directory structure, routing, controllers, and form handling with CSRF protection and validation techniques.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views11 pages

Detailed Laravel Lesson 2 3 SE331

Laravel is a PHP web framework that follows the MVC architecture, designed for building scalable web applications. It simplifies various tasks such as routing, database access, and authentication, and includes features like the Blade templating engine and Eloquent ORM for database interactions. The document also covers installation, directory structure, routing, controllers, and form handling with CSRF protection and validation techniques.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Laravel Fundamentals

Lesson 2 & 3 – SE331: Software


Engineering Design Capstone Project
What is Laravel?
• • Laravel is a PHP web framework following
the MVC architecture.
• • Used for building modern, scalable web
applications.
• • It simplifies routing, database access,
authentication, and more.
Installing Laravel
• • Install Composer (PHP dependency
manager).
• • Use command: composer create-project
laravel/laravel project-name
• • Start development server: php artisan serve
Laravel Directory Structure
• • app/: Core application code (Models,
Controllers).
• • routes/: Define web and API routes
(web.php, api.php).
• • resources/: Views, Blade templates, assets.
• • config/: Configuration files for Laravel
features.
• • public/: Publicly accessible files (index.php,
CSS, JS).
Routing and Controllers
• • Define routes in routes/web.php using
Route::get, Route::post, etc.
• • Create controller: php artisan
make:controller PageController
• • Map routes to controller actions for better
organization.
Blade Templating Engine
• • Blade is Laravel’s powerful, lightweight
templating engine.
• • Supports @if, @foreach, @extends,
@section for layout inheritance.
• • Use {{ $variable }} to print dynamic content.
Laravel Artisan Commands
• • php artisan list – shows all available
commands.
• • make:controller, make:model, migrate – for
creating components.
• • tinker – interact with your app via
command-line.
Models and Migrations
• • Model: Represents a database table
(Eloquent ORM).
• • Migration: Creates/modifies database tables
using PHP code.
• • Run migrations: php artisan migrate
Using Eloquent ORM
• • Simple syntax for database operations like
insert, update, fetch.
• • Example: User::all(), Post::where('id', 1)-
>first()
• • Supports relationships: hasOne, hasMany,
belongsTo
Handling Forms and CSRF
• • Forms in Blade: Use POST method and @csrf
directive.
• • Controller handles input via $request-
>input()
• • CSRF protection prevents cross-site request
forgery attacks.
Validation and Mini Task
• • Validate input in controller using $request-
>validate([...])
• • Display validation errors in Blade using
@error directive.
• • Mini Task: Create a form to input user data
and display it on another page.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy