1/12
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
What is laravel ?
It is a modern PHP framework used to build web applications quickly and securely
It provides the wr .
Why laravel is used ?
Saves deployment time
Provides ready-made features
Clean and structured code
Built-in security
MVC Architecture (Core concept)
MVC = Model + View + Controller
Model:
It handles data and databases
Interact with tables
Ex: User::all();
View:
What the user sees (UI)
Written in HTML + Blade (Laravel Template engine)
<h1>Welcome, Byam</h1>
Controller:
It act as a middleman.
Take request → processes → return response
public funtion index(){
return view('home');
}What is the flow of MVC?
The user sends a request.
The route sends it to the controller.
The controller talks to the model.
The model returns data.
The controller sends data to view.
View shows output.
What is the enviroment setup?
It is an environment setup, which means preparing your system so you can run laravel projects smoothly
Installing required software
Setting up laravel
Running your first project
System Requirement
Before installing Laravel, make sure the system has:
PHP through XAMPP
Composer : Tools to manage PHP Packages
Web Server
Database
What do you mean by routing?
Routing means defining how you application response to different URL’s
What are the types of Route ?
Basic Route
HTTP Method Routes
Named Routes
Route Groups
Route w/ Controller
Basic Routes
Simplest type of route
Directly returns something
Route::get('/', function () {
return "Welcome";
});HTTP Method Routes
Laravel supports different request types:
Get:
Route::get('/home', function () {
return "Home Page";
});Post:
Route::post('/submit', function () {
return "Form Submitted";
});Put:
Route::put('/update', function () {
return "Updated";
});Delete:
Route::delete('/delete', function () {
return "Deleted";
});Named Routes
Assign a name to route
Route::get('/home', function () {
return "Home";
})->name('home');Route Groups
Groups multiple routes together
Route::prefix('admin')->group(function () {
Route::get('/dashboard', function () {
return "Admin Dashboard";
});
});Route with controller
Instead of writing logic in route, use a controller.
Route::get('/users', [UserController::class, 'index']);