title | author | format | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Introduction to Laravel |
Vladimir Lelicanin - SAE Institute |
|
Laravel is a free, open-source, PHP web application framework with expressive, elegant syntax. Laravel makes it easy to build modern, robust, web applications with the help of its built-in features and functionality.
Here are some key features of Laravel:
- Routing
- Blade Templating Engine
- Eloquent ORM (Object-Relational Mapping)
- Middleware
- Authentication
- Artisan CLI (Command Line Interface)
Route::get('/', function () {
return view('welcome');
});
Route::get('/about', function () {
return view('about');
});
More on routing documentation.
<!DOCTYPE html>
<html>
<head>
<title>@yield('title')</title>
</head>
<body>
<div class="container">
@yield('content')
</div>
</body>
</html>
More on Blade documentation.
// Retrieve all records
$users = User::all();
// Query with filter
$users = User::where('active', true)->get();
// Create a new record
$user = new User;
$user->name = 'John Doe';
$user->email = '[email protected]';
$user->save();
More on Eloquent documentation.
public function handle($request, Closure $next)
{
if (! $request->hasValidSignature()) {
abort(401);
}
return $next($request);
}
More on Middleware documentation.
public function authenticate(Request $request)
{
$credentials = $request->only('email', 'password');
if (Auth::attempt($credentials)) {
$request->session()->regenerate();
return redirect()->intended('dashboard');
}
return back()->withErrors([
'email' => 'The provided credentials do not match our records.',
]);
}
More on Authentication documentation.
php artisan make:model User
php artisan make:controller UserController
php artisan make:migration create_users_table
More on Artisan documentation.
- Robustness and Modularity
- Many built-in features
- Rapid development
- Easy database migration and seeding
- Large community and many packages
- MVC architecture
- The Laravel community is very active and helpful
- You can get help on the Laravel official Slack or the Laravel Forum
- Many resources available including podcasts, blogs, and video tutorials
- You can also keep yourself updated by following Laravel updates on social media
- Laravel is a modern PHP web application framework designed for web developers
- Laravel's numerous built-in features make it simple to build robust web applications
- It enables high-quality, efficient, and secure web development
- Laravel provides a large and supportive community