Introduction to Laravel
Prerequisites: Building a REST API in depth
Laravel is the most widely used PHP framework — batteries included: routing, an ORM (Eloquent), templating (Blade), and everything from this course wired together conventionally.
// routes/web.php
Route::get('/users/{id}', function (int $id) {
return User::findOrFail($id);
});
// app/Models/User.php
class User extends Model
{
protected $fillable = ['name', 'email'];
}
User::create(['name' => 'Ada', 'email' => 'ada@example.com']);
User::findOrFail($id) and User::create([...]) replace the raw
PDO queries from Level 2 with an ORM — Eloquent generates the
SQL, parameterized safely, from these expressive method calls.