<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Vincent Tommi</title>
    <description>The latest articles on DEV Community by Vincent Tommi (@vincenttommi).</description>
    <link>https://dev.to/vincenttommi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1057211%2Fb677487b-3f87-456c-b555-669a164fba50.jpeg</url>
      <title>DEV Community: Vincent Tommi</title>
      <link>https://dev.to/vincenttommi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vincenttommi"/>
    <language>en</language>
    <item>
      <title>Laravel for Django Developers: A Practical Guide to Laravel Architecture</title>
      <dc:creator>Vincent Tommi</dc:creator>
      <pubDate>Fri, 04 Sep 2026 12:49:59 +0000</pubDate>
      <link>https://dev.to/vincenttommi/-laravel-for-django-developers-a-practical-guide-to-laravel-architecture-478f</link>
      <guid>https://dev.to/vincenttommi/-laravel-for-django-developers-a-practical-guide-to-laravel-architecture-478f</guid>
      <description>&lt;p&gt;If you've spent some time building applications with Django and have decided to explore Laravel, you may initially feel like you're learning backend development all over again.&lt;/p&gt;

&lt;p&gt;You're not.&lt;/p&gt;

&lt;p&gt;The syntax is different. The project structure is different. The terminology is different. But many of the architectural ideas behind Laravel will feel surprisingly familiar if you've worked with Django.&lt;/p&gt;

&lt;p&gt;This article is a practical guide for &lt;strong&gt;Django developers transitioning to Laravel&lt;/strong&gt;. Instead of learning Laravel concepts in isolation, we'll map them to their Django equivalents and build a mental model of how a Laravel application works.&lt;/p&gt;

&lt;p&gt;By the end, you should be able to look at a Laravel project and understand where routes, controllers, models, validation, authentication, business logic, and database operations belong.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Django vs Laravel: The Mental Translation
&lt;/h2&gt;

&lt;p&gt;The easiest way to start learning Laravel as a Django developer is to create a mental translation table.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Django&lt;/th&gt;
&lt;th&gt;Laravel&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Django project&lt;/td&gt;
&lt;td&gt;Laravel application&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Django app&lt;/td&gt;
&lt;td&gt;No exact equivalent&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;urls.py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;routes/web.php&lt;/code&gt;, &lt;code&gt;routes/api.php&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;View function / Class-Based View&lt;/td&gt;
&lt;td&gt;Controller method&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Django ORM&lt;/td&gt;
&lt;td&gt;Eloquent ORM&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Model&lt;/td&gt;
&lt;td&gt;Model&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;models.py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;app/Models/&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DRF Serializer&lt;/td&gt;
&lt;td&gt;API Resource / Form Request&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Django Forms&lt;/td&gt;
&lt;td&gt;Form Requests&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Middleware&lt;/td&gt;
&lt;td&gt;Middleware&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;settings.py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;.env&lt;/code&gt; + &lt;code&gt;config/&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;manage.py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;artisan&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Django migrations&lt;/td&gt;
&lt;td&gt;Laravel migrations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Django templates&lt;/td&gt;
&lt;td&gt;Blade&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;JsonResponse&lt;/code&gt; / DRF Response&lt;/td&gt;
&lt;td&gt;&lt;code&gt;response()-&amp;gt;json()&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Django signals&lt;/td&gt;
&lt;td&gt;Events / Observers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Management commands&lt;/td&gt;
&lt;td&gt;Artisan commands&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Composer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;requirements.txt&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;composer.json&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Celery&lt;/td&gt;
&lt;td&gt;Laravel Queues / Jobs&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The important thing is not to assume that these are exact one-to-one replacements.&lt;/p&gt;

&lt;p&gt;They aren't.&lt;/p&gt;

&lt;p&gt;They are simply useful mental bridges.&lt;/p&gt;

&lt;p&gt;For example, a Laravel API Resource and a Django REST Framework Serializer both help shape API responses, but they work differently.&lt;/p&gt;




&lt;h1&gt;
  
  
  2. The Laravel Request Lifecycle
&lt;/h1&gt;

&lt;p&gt;Before learning individual Laravel components, understand what happens when a request reaches your application.&lt;/p&gt;

&lt;p&gt;Imagine a React frontend sends:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;POST /api/properties
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A simplified Laravel request lifecycle looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;React / Browser / Mobile App
            |
            v
       HTTP Request
            |
            v
      public/index.php
            |
            v
        Bootstrap
            |
            v
        Middleware
            |
            v
          Router
            |
            v
        Controller
            |
       +----+----+
       |         |
       v         v
   Validation  Business Logic
                 |
                 v
              Model
                 |
                 v
             Database
                 |
                 v
              Resource
                 |
                 v
           JSON Response
                 |
                 v
               Client
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the architecture you should keep in your head while learning Laravel.&lt;/p&gt;




&lt;h1&gt;
  
  
  3. Laravel Project Structure
&lt;/h1&gt;

&lt;p&gt;A fresh Laravel project looks roughly like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my-project/
│
├── app/
│   ├── Console/
│   ├── Exceptions/
│   ├── Http/
│   │   ├── Controllers/
│   │   ├── Middleware/
│   │   └── Requests/
│   │
│   ├── Models/
│   └── Providers/
│
├── bootstrap/
│
├── config/
│
├── database/
│   ├── factories/
│   ├── migrations/
│   └── seeders/
│
├── public/
│   └── index.php
│
├── resources/
│   ├── views/
│   ├── css/
│   └── js/
│
├── routes/
│   ├── web.php
│   ├── api.php
│   └── console.php
│
├── storage/
│
├── tests/
│
├── vendor/
│
├── .env
├── artisan
└── composer.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you're coming from Django, this structure might initially feel strange.&lt;/p&gt;

&lt;p&gt;Django encourages you to break functionality into applications:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;project/
├── users/
├── properties/
├── bookings/
└── payments/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Laravel doesn't enforce that approach.&lt;/p&gt;

&lt;p&gt;Instead, a typical Laravel application organizes code around responsibilities:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;app/
├── Models/
├── Http/
│   ├── Controllers/
│   ├── Requests/
│   └── Middleware/
└── Services/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can still organize a large Laravel project by domain or feature, but Laravel itself doesn't force you to create an "app" for every feature.&lt;/p&gt;




&lt;h1&gt;
  
  
  4. Routes: Django's &lt;code&gt;urls.py&lt;/code&gt; vs Laravel Routes
&lt;/h1&gt;

&lt;p&gt;If you've used Django, routing is easy to understand.&lt;/p&gt;

&lt;p&gt;In Django you might have:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nf"&gt;path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;properties/&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;views&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;properties&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Laravel uses:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Route&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s1"&gt;'/properties'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;PropertyController&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'index'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Laravel routes are commonly placed in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;routes/
├── web.php
├── api.php
└── console.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Route&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/properties'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="nc"&gt;PropertyController&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'index'&lt;/span&gt;
&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;POST:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Route&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/properties'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="nc"&gt;PropertyController&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'store'&lt;/span&gt;
&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;PUT:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Route&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;put&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/properties/{id}'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="nc"&gt;PropertyController&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'update'&lt;/span&gt;
&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;DELETE:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Route&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nb"&gt;delete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/properties/{id}'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="nc"&gt;PropertyController&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'destroy'&lt;/span&gt;
&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Laravel makes the HTTP method explicit in the route definition.&lt;/p&gt;




&lt;h1&gt;
  
  
  5. Route Parameters
&lt;/h1&gt;

&lt;p&gt;In Django you might write:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nf"&gt;path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;properties/&amp;lt;int:id&amp;gt;/&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;views&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;property_detail&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Laravel:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Route&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s1"&gt;'/properties/{id}'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;PropertyController&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'show'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then your controller can receive the ID:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;show&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;//&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A request such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET /properties/10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;gives:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Laravel also supports a more powerful feature called &lt;strong&gt;route model binding&lt;/strong&gt;, which we'll get to later.&lt;/p&gt;




&lt;h1&gt;
  
  
  6. Controllers: Django Views vs Laravel Controllers
&lt;/h1&gt;

&lt;p&gt;This is one of the easiest concepts to transfer.&lt;/p&gt;

&lt;p&gt;A Django function-based view might look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;properties&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;properties&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Property&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;objects&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;JsonResponse&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;properties&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;properties&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;values&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A Laravel controller could look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;PropertyController&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Controller&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nv"&gt;$properties&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Property&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;response&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
            &lt;span class="s1"&gt;'properties'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$properties&lt;/span&gt;
        &lt;span class="p"&gt;]);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Conceptually:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Django View
     ≈
Laravel Controller Method
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a controller with Artisan:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan make:controller PropertyController
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Laravel creates:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;app/Http/Controllers/PropertyController.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  7. Models and Eloquent
&lt;/h1&gt;

&lt;p&gt;If there is one Laravel feature Django developers will understand almost immediately, it's &lt;strong&gt;Eloquent&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Eloquent is Laravel's ORM.&lt;/p&gt;

&lt;p&gt;Django:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;Property&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;objects&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Laravel:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Property&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Django:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;Property&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;objects&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Laravel:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Property&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Django:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;Property&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;objects&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;available&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Laravel:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Property&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;where&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s1"&gt;'status'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'available'&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Django:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;Property&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;objects&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;price__gt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;10000&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Laravel:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Property&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;where&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s1"&gt;'price'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'&amp;gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="mi"&gt;10000&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The syntax is different, but the underlying idea is the same:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Application
     |
     v
ORM
     |
     v
Database
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  8. Creating Models
&lt;/h1&gt;

&lt;p&gt;Create a Laravel model:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan make:model Property
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will get something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;app/Models/Property.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A model might look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Property&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Model&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="nv"&gt;$fillable&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s1"&gt;'name'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'location'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'price'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can then create records:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$property&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Property&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="s1"&gt;'name'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Apartment A'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'location'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Nairobi'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'price'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;25000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Django equivalent is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;Property&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;objects&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Apartment A&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;location&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Nairobi&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;price&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;25000&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  9. Mass Assignment
&lt;/h1&gt;

&lt;p&gt;One Laravel concept that might initially confuse Django developers is &lt;strong&gt;mass assignment&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;You'll frequently see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="nv"&gt;$fillable&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="s1"&gt;'name'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'location'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'price'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This controls which attributes can be assigned through methods such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Property&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="s1"&gt;'name'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Apartment A'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'location'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Nairobi'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'price'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;25000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It's an important security mechanism.&lt;/p&gt;

&lt;p&gt;You should understand &lt;code&gt;$fillable&lt;/code&gt; and &lt;code&gt;$guarded&lt;/code&gt; early when learning Eloquent.&lt;/p&gt;




&lt;h1&gt;
  
  
  10. Migrations
&lt;/h1&gt;

&lt;p&gt;If you've worked with Django migrations, Laravel migrations will feel familiar.&lt;/p&gt;

&lt;p&gt;Django:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python manage.py makemigrations
python manage.py migrate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Laravel:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan make:migration create_properties_table
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan migrate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A migration might look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Schema&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'properties'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;Blueprint&lt;/span&gt; &lt;span class="nv"&gt;$table&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$table&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;id&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nv"&gt;$table&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'name'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nv"&gt;$table&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'location'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nv"&gt;$table&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;decimal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'price'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nv"&gt;$table&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;timestamps&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Compare that with Django:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Property&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;CharField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_length&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;location&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;CharField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_length&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;price&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DecimalField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;max_digits&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;decimal_places&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The syntax is different, but you're expressing the same database structure.&lt;/p&gt;




&lt;h1&gt;
  
  
  11. Artisan: Laravel's &lt;code&gt;manage.py&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;If Django has:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python manage.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Laravel has:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Artisan is one of the most important tools in the Laravel ecosystem.&lt;/p&gt;

&lt;p&gt;Some commands you'll use frequently:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan serve
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Start the development server.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan route:list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Display your application's routes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan make:model Property
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a model.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan make:controller PropertyController
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a controller.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan make:request StorePropertyRequest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a validation request.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan make:resource PropertyResource
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create an API Resource.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan migrate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run migrations.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan migrate:rollback
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Roll back migrations.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan migrate:fresh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Drop all tables and rebuild the database.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan db:seed
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run seeders.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan optimize:clear
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Clear Laravel's cached configuration, routes, views, and other optimized files.&lt;/p&gt;

&lt;p&gt;A good rule:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you're wondering whether Laravel has a CLI command for something, check Artisan first.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  12. Relationships
&lt;/h1&gt;

&lt;p&gt;Laravel's Eloquent relationships are another area where Django developers should feel at home.&lt;/p&gt;

&lt;p&gt;Suppose a property belongs to a landlord.&lt;/p&gt;

&lt;p&gt;Django:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Property&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;landlord&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ForeignKey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;User&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;on_delete&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CASCADE&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Laravel:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Property&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Model&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;landlord&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;belongsTo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;
        &lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you can access:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$property&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;landlord&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  13. One-to-Many Relationships
&lt;/h1&gt;

&lt;p&gt;Suppose a landlord owns multiple properties.&lt;/p&gt;

&lt;p&gt;Laravel:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Landlord&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Model&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;properties&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;hasMany&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="nc"&gt;Property&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;
        &lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$landlord&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;properties&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Django might be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;landlord&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;properties&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;assuming you configured the appropriate &lt;code&gt;related_name&lt;/code&gt;.&lt;/p&gt;




&lt;h1&gt;
  
  
  14. Many-to-Many Relationships
&lt;/h1&gt;

&lt;p&gt;Django:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;courses&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ManyToManyField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;Course&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Laravel:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;courses&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;belongsToMany&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="nc"&gt;Course&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;
    &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$student&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;courses&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Again, the terminology changes but the database relationship remains the same.&lt;/p&gt;




&lt;h1&gt;
  
  
  15. Eager Loading
&lt;/h1&gt;

&lt;p&gt;One of the most important ORM concepts is avoiding unnecessary database queries.&lt;/p&gt;

&lt;p&gt;Laravel:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Property&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;with&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'landlord'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Django's rough equivalent:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;Property&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;objects&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;select_related&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;landlord&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For collection relationships:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Property&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;with&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'bookings'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;is conceptually similar to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;Property&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;objects&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;prefetch_related&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;bookings&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is important because both Django and Laravel applications can suffer from the infamous &lt;strong&gt;N+1 query problem&lt;/strong&gt;.&lt;/p&gt;




&lt;h1&gt;
  
  
  16. Validation: DRF Serializers vs Laravel Form Requests
&lt;/h1&gt;

&lt;p&gt;This is where the architecture starts becoming noticeably different.&lt;/p&gt;

&lt;p&gt;In Django REST Framework, you might put validation inside a serializer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;PropertySerializer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;serializers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ModelSerializer&lt;/span&gt;
&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Meta&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Property&lt;/span&gt;
        &lt;span class="n"&gt;fields&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;__all__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;validate_price&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="n"&gt;serializers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ValidationError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Price cannot be negative&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
            &lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Laravel commonly separates request validation into a &lt;strong&gt;Form Request&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Create one:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan make:request StorePropertyRequest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;StorePropertyRequest&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;FormRequest&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;rules&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="kt"&gt;array&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="s1"&gt;'name'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="s1"&gt;'required'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'string'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'max:255'&lt;/span&gt;
            &lt;span class="p"&gt;],&lt;/span&gt;

            &lt;span class="s1"&gt;'location'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="s1"&gt;'required'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'string'&lt;/span&gt;
            &lt;span class="p"&gt;],&lt;/span&gt;

            &lt;span class="s1"&gt;'price'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="s1"&gt;'required'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'numeric'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'min:0'&lt;/span&gt;
            &lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="p"&gt;];&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then inject it into your controller:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;store&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="kt"&gt;StorePropertyRequest&lt;/span&gt; &lt;span class="nv"&gt;$request&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;//&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Laravel automatically validates the incoming request before your controller method proceeds.&lt;/p&gt;




&lt;h1&gt;
  
  
  17. API Resources: Think DRF Serializer Output
&lt;/h1&gt;

&lt;p&gt;Laravel has &lt;strong&gt;API Resources&lt;/strong&gt; for transforming models into API responses.&lt;/p&gt;

&lt;p&gt;Create one:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan make:resource PropertyResource
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;PropertyResource&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;JsonResource&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;toArray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="kt"&gt;Request&lt;/span&gt; &lt;span class="nv"&gt;$request&lt;/span&gt;
    &lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kt"&gt;array&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="s1"&gt;'id'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'name'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'location'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;location&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'price'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;price&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;];&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;PropertyResource&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$property&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For collections:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;PropertyResource&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;collection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nc"&gt;Property&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A useful mental model is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DRF Serializer
       |
       +---- validation/input
       |
       +---- representation/output

Laravel
       |
       +---- Form Request
       |       -&amp;gt; validation
       |
       +---- API Resource
               -&amp;gt; representation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Laravel separates these responsibilities more explicitly.&lt;/p&gt;




&lt;h1&gt;
  
  
  18. Middleware
&lt;/h1&gt;

&lt;p&gt;Django developers already understand middleware.&lt;/p&gt;

&lt;p&gt;Django:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;MIDDLEWARE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="bp"&gt;...&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Laravel:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Route&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;middleware&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'auth'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;group&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// protected routes&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can create middleware using Artisan:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan make:middleware CheckUserRole
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$request&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;user&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;role&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="s1"&gt;'admin'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;abort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;403&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Middleware is useful for concerns that should happen before or after controller execution, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Authentication&lt;/li&gt;
&lt;li&gt;Logging&lt;/li&gt;
&lt;li&gt;Rate limiting&lt;/li&gt;
&lt;li&gt;CORS&lt;/li&gt;
&lt;li&gt;Role checks&lt;/li&gt;
&lt;li&gt;Request modification&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  19. Authentication and Authorization
&lt;/h1&gt;

&lt;p&gt;Laravel supports several authentication approaches.&lt;/p&gt;

&lt;p&gt;One commonly encountered solution for API and SPA applications is &lt;strong&gt;Laravel Sanctum&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A typical architecture might look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;React
  |
  v
Laravel API
  |
  v
Authentication
  |
  v
Controller
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you're coming from Django REST Framework and JWT, don't assume Sanctum is simply "Laravel's JWT."&lt;/p&gt;

&lt;p&gt;Sanctum provides API token authentication and SPA authentication capabilities, but its model and workflow differ from JWT-based authentication.&lt;/p&gt;

&lt;p&gt;Laravel also provides:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Gates&lt;/li&gt;
&lt;li&gt;Policies&lt;/li&gt;
&lt;li&gt;Middleware&lt;/li&gt;
&lt;li&gt;Authentication guards&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These become especially important as your application grows.&lt;/p&gt;




&lt;h1&gt;
  
  
  20. Policies and Gates
&lt;/h1&gt;

&lt;p&gt;Suppose a landlord should only be allowed to update their own property.&lt;/p&gt;

&lt;p&gt;You could check this directly inside a controller, but Laravel provides authorization mechanisms such as &lt;strong&gt;Policies&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Conceptually:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User
  |
  v
Can this user update this property?
  |
  +---- YES ---&amp;gt; Continue
  |
  +---- NO ----&amp;gt; 403 Forbidden
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This keeps authorization logic separate from your business logic.&lt;/p&gt;

&lt;p&gt;If you've used Django permissions, this is an area you'll want to explore carefully.&lt;/p&gt;




&lt;h1&gt;
  
  
  21. Environment Variables and Configuration
&lt;/h1&gt;

&lt;p&gt;Laravel uses a &lt;code&gt;.env&lt;/code&gt; file for environment-specific configuration.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;APP_NAME=Laravel
APP_ENV=local
APP_DEBUG=true

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=my_database
DB_USERNAME=root
DB_PASSWORD=
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Django developers may recognize this approach from using packages such as &lt;code&gt;python-decouple&lt;/code&gt; or &lt;code&gt;django-environ&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Laravel configuration is stored under:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;config/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;config/
├── app.php
├── database.php
├── auth.php
├── cache.php
└── filesystems.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Django developers can think of this as a more distributed equivalent of &lt;code&gt;settings.py&lt;/code&gt;.&lt;/p&gt;




&lt;h1&gt;
  
  
  22. Blade Templates
&lt;/h1&gt;

&lt;p&gt;Laravel's server-side templating engine is called &lt;strong&gt;Blade&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Django:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;{{ property.name }}&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Blade:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;h1&amp;gt;{{ $property-&amp;gt;name }}&amp;lt;/h1&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Django:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jinja"&gt;&lt;code&gt;&lt;span class="cp"&gt;{%&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="nv"&gt;property&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nv"&gt;properties&lt;/span&gt; &lt;span class="cp"&gt;%}&lt;/span&gt;
    &lt;span class="cp"&gt;{{&lt;/span&gt; &lt;span class="nv"&gt;property.name&lt;/span&gt; &lt;span class="cp"&gt;}}&lt;/span&gt;
&lt;span class="cp"&gt;{%&lt;/span&gt; &lt;span class="k"&gt;endfor&lt;/span&gt; &lt;span class="cp"&gt;%}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Blade:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@foreach($properties as $property)
    {{ $property-&amp;gt;name }}
@endforeach
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you're building a Laravel API consumed by React, you may use Blade very little.&lt;/p&gt;

&lt;p&gt;If you're building a traditional Laravel web application, Blade becomes much more important.&lt;/p&gt;




&lt;h1&gt;
  
  
  23. Dependency Injection and the Service Container
&lt;/h1&gt;

&lt;p&gt;This is one of the Laravel concepts I recommend Django developers spend extra time understanding.&lt;/p&gt;

&lt;p&gt;Suppose your controller depends on a service:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;PropertyController&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Controller&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;__construct&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="kt"&gt;PropertyService&lt;/span&gt; &lt;span class="nv"&gt;$propertyService&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;propertyService&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
            &lt;span class="nv"&gt;$propertyService&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Laravel's &lt;strong&gt;Service Container&lt;/strong&gt; can resolve that dependency for you.&lt;/p&gt;

&lt;p&gt;Conceptually:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Controller
    |
    | requires
    v
PropertyService
    |
    v
Laravel Service Container
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is Laravel's dependency injection system.&lt;/p&gt;

&lt;p&gt;Once you understand the Service Container, concepts such as service providers, bindings, interfaces, and dependency injection become much easier.&lt;/p&gt;




&lt;h1&gt;
  
  
  24. Services and Business Logic
&lt;/h1&gt;

&lt;p&gt;Laravel applications often introduce service classes for complex business logic.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;app/
└── Services/
    ├── PropertyService.php
    ├── BookingService.php
    └── PaymentService.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A service might contain:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;PropertyService&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="kt"&gt;array&lt;/span&gt; &lt;span class="nv"&gt;$data&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;Property&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then your controller becomes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;store&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="kt"&gt;StorePropertyRequest&lt;/span&gt; &lt;span class="nv"&gt;$request&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$property&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
        &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;propertyService&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="nv"&gt;$request&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;validated&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;PropertyResource&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="nv"&gt;$property&lt;/span&gt;
    &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The idea is to prevent controllers from becoming massive.&lt;/p&gt;

&lt;p&gt;Instead of:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Controller
 ├── validation
 ├── authorization
 ├── payment
 ├── database logic
 ├── email
 ├── notifications
 └── business rules
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;you can have:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Controller
     |
     v
Service
     |
     +---- Model
     +---- Payment
     +---- Notification
     +---- Events
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Don't create a service class for every two-line database query, though.&lt;/p&gt;

&lt;p&gt;Use this architecture when it actually improves separation of responsibilities.&lt;/p&gt;




&lt;h1&gt;
  
  
  25. Events and Listeners
&lt;/h1&gt;

&lt;p&gt;Laravel has an event-driven architecture available through Events and Listeners.&lt;/p&gt;

&lt;p&gt;Imagine a user registers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User registers
      |
      v
UserRegistered event
      |
      +----&amp;gt; SendWelcomeEmail
      |
      +----&amp;gt; CreateProfile
      |
      +----&amp;gt; NotifyAdmin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This keeps secondary operations out of the main request logic.&lt;/p&gt;

&lt;p&gt;Django developers may find this somewhat similar to using signals, although Laravel Events and Listeners provide a different and often more explicit architecture.&lt;/p&gt;




&lt;h1&gt;
  
  
  26. Jobs and Queues
&lt;/h1&gt;

&lt;p&gt;If you've used Celery with Django, Laravel's Jobs and Queues should make sense.&lt;/p&gt;

&lt;p&gt;Suppose sending 10,000 emails would make a request slow.&lt;/p&gt;

&lt;p&gt;Instead:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HTTP Request
     |
     v
Create Job
     |
     v
Queue
     |
     v
Worker
     |
     v
Send Emails
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a job:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan make:job SendNewsletter
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then dispatch it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;SendNewsletter&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;dispatch&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The user doesn't necessarily have to wait for the expensive operation to finish.&lt;/p&gt;

&lt;p&gt;This is extremely useful for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Emails&lt;/li&gt;
&lt;li&gt;Notifications&lt;/li&gt;
&lt;li&gt;Image processing&lt;/li&gt;
&lt;li&gt;Reports&lt;/li&gt;
&lt;li&gt;Payments&lt;/li&gt;
&lt;li&gt;Imports&lt;/li&gt;
&lt;li&gt;Exports&lt;/li&gt;
&lt;li&gt;Heavy calculations&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  27. Scheduling
&lt;/h1&gt;

&lt;p&gt;Laravel also includes a task scheduling system.&lt;/p&gt;

&lt;p&gt;You might have a task that needs to run regularly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Every day
    |
    v
Find overdue rent
    |
    v
Send reminders
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Every hour
    |
    v
Clean expired sessions
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This functionality can be combined with Artisan commands and queued jobs.&lt;/p&gt;

&lt;p&gt;If you're coming from Django, think of this as part of the territory often handled by cron, Celery Beat, management commands, or similar tools.&lt;/p&gt;




&lt;h1&gt;
  
  
  28. Seeders and Factories
&lt;/h1&gt;

&lt;p&gt;Laravel provides database seeders:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan db:seed
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Property&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="s1"&gt;'name'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Apartment A'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'location'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Nairobi'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'price'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;25000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Factories allow you to generate test/development data.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Property&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;factory&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;count&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is conceptually similar to using tools such as &lt;code&gt;factory_boy&lt;/code&gt; in Django projects.&lt;/p&gt;




&lt;h1&gt;
  
  
  29. A Complete Laravel API Example
&lt;/h1&gt;

&lt;p&gt;Let's put the pieces together.&lt;/p&gt;

&lt;p&gt;Suppose we're creating:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;POST /api/properties
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The route:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Route&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s1"&gt;'/properties'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;PropertyController&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'store'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The request validation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;StorePropertyRequest&lt;/span&gt;
    &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;FormRequest&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;rules&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="kt"&gt;array&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="s1"&gt;'name'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="s1"&gt;'required'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'string'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'max:255'&lt;/span&gt;
            &lt;span class="p"&gt;],&lt;/span&gt;

            &lt;span class="s1"&gt;'location'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="s1"&gt;'required'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'string'&lt;/span&gt;
            &lt;span class="p"&gt;],&lt;/span&gt;

            &lt;span class="s1"&gt;'price'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="s1"&gt;'required'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'numeric'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'min:0'&lt;/span&gt;
            &lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="p"&gt;];&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The model:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Property&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Model&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="nv"&gt;$fillable&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s1"&gt;'name'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'location'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'price'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The controller:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;PropertyController&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Controller&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;store&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="kt"&gt;StorePropertyRequest&lt;/span&gt; &lt;span class="nv"&gt;$request&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nv"&gt;$property&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Property&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="nv"&gt;$request&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;validated&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;PropertyResource&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="nv"&gt;$property&lt;/span&gt;
        &lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The resource:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;PropertyResource&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;JsonResource&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;toArray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="kt"&gt;Request&lt;/span&gt; &lt;span class="nv"&gt;$request&lt;/span&gt;
    &lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kt"&gt;array&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="s1"&gt;'id'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'name'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'location'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;location&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'price'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;price&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;];&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The client sends:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;POST /api/properties
Content-Type: application/json
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Apartment A"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"location"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Nairobi"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"price"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;25000&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Laravel processes it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;POST /api/properties
        |
        v
Route
        |
        v
PropertyController
        |
        v
StorePropertyRequest
        |
        v
validated()
        |
        v
Property::create()
        |
        v
Eloquent
        |
        v
MySQL
        |
        v
PropertyResource
        |
        v
JSON Response
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's a real Laravel API architecture.&lt;/p&gt;




&lt;h1&gt;
  
  
  30. Translating a Django Project to Laravel
&lt;/h1&gt;

&lt;p&gt;Let's say you've already built a landlord/tenant system in Django.&lt;/p&gt;

&lt;p&gt;Your Django architecture might look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Django
│
├── users
├── properties
├── bookings
├── payments
└── maintenance
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Laravel equivalent could look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Laravel
│
├── Models
│   ├── User.php
│   ├── Property.php
│   ├── Booking.php
│   ├── RentPayment.php
│   └── MaintenanceTicket.php
│
├── Http
│   ├── Controllers
│   │   ├── AuthController.php
│   │   ├── PropertyController.php
│   │   ├── BookingController.php
│   │   └── PaymentController.php
│   │
│   ├── Requests
│   │   ├── LoginRequest.php
│   │   ├── StorePropertyRequest.php
│   │   └── StoreBookingRequest.php
│   │
│   └── Resources
│       ├── UserResource.php
│       ├── PropertyResource.php
│       └── BookingResource.php
│
└── Services
    ├── AuthService.php
    ├── PropertyService.php
    └── PaymentService.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then your API flow becomes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;React
  |
  | POST /api/properties
  v
Laravel Router
  |
  v
PropertyController
  |
  v
StorePropertyRequest
  |
  v
Authorization
  |
  v
PropertyService
  |
  v
Property Model
  |
  v
MySQL
  |
  v
PropertyResource
  |
  v
JSON
  |
  v
React
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a very useful architecture for someone already comfortable with Django REST Framework.&lt;/p&gt;




&lt;h1&gt;
  
  
  31. What You Should NOT Do as a Django Developer
&lt;/h1&gt;

&lt;p&gt;One of the biggest mistakes when moving frameworks is trying to force your old framework's architecture into the new framework.&lt;/p&gt;

&lt;p&gt;Don't assume:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Laravel = Django written in PHP
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It isn't.&lt;/p&gt;

&lt;p&gt;For example, don't automatically create:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PropertySerializer
PropertyView
PropertyForm
PropertyService
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;just because that's how you might structure something in Django.&lt;/p&gt;

&lt;p&gt;Instead, understand what Laravel provides and use each component where it makes sense.&lt;/p&gt;

&lt;p&gt;Likewise, don't put everything inside controllers simply because Laravel makes it easy.&lt;/p&gt;

&lt;p&gt;A controller containing 500 lines of business logic isn't good Laravel architecture.&lt;/p&gt;




&lt;h1&gt;
  
  
  32. The Laravel Architecture to Learn
&lt;/h1&gt;

&lt;p&gt;I'd recommend learning Laravel in roughly this order.&lt;/p&gt;

&lt;h2&gt;
  
  
  Level 1 — Foundation
&lt;/h2&gt;

&lt;p&gt;Learn:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PHP
  ↓
Composer
  ↓
Laravel installation
  ↓
Project structure
  ↓
Artisan
  ↓
Routes
  ↓
Controllers
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Level 2 — Database
&lt;/h2&gt;

&lt;p&gt;Then:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Migrations
  ↓
Models
  ↓
Eloquent
  ↓
Relationships
  ↓
Query Builder
  ↓
Factories
  ↓
Seeders
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Level 3 — API Development
&lt;/h2&gt;

&lt;p&gt;Then:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HTTP Requests
  ↓
Validation
  ↓
Form Requests
  ↓
API Resources
  ↓
Pagination
  ↓
JSON responses
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Level 4 — Security
&lt;/h2&gt;

&lt;p&gt;Then:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Authentication
  ↓
Middleware
  ↓
Policies
  ↓
Gates
  ↓
Authorization
  ↓
Sanctum
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Level 5 — Laravel Architecture
&lt;/h2&gt;

&lt;p&gt;Then:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Service Container
  ↓
Dependency Injection
  ↓
Service Providers
  ↓
Services
  ↓
Events
  ↓
Listeners
  ↓
Jobs
  ↓
Queues
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Level 6 — Production
&lt;/h2&gt;

&lt;p&gt;Finally:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Caching
  ↓
Queues
  ↓
Scheduling
  ↓
Logging
  ↓
Testing
  ↓
Workers
  ↓
Deployment
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  33. The Most Important Concepts to Focus On
&lt;/h1&gt;

&lt;p&gt;If you've already read the Django documentation, don't try to learn every Laravel feature immediately.&lt;/p&gt;

&lt;p&gt;Focus heavily on these:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Eloquent
&lt;/h3&gt;

&lt;p&gt;Understand:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Model&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="nc"&gt;Model&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="nc"&gt;Model&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;where&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="nc"&gt;Model&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="nc"&gt;Model&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="nc"&gt;Model&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nb"&gt;delete&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then move into relationships and eager loading.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Form Requests
&lt;/h3&gt;

&lt;p&gt;Understand how Laravel validates incoming data.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. API Resources
&lt;/h3&gt;

&lt;p&gt;Understand how Laravel transforms models into API responses.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Middleware
&lt;/h3&gt;

&lt;p&gt;Understand where authentication, rate limiting, and request processing happen.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Policies and Gates
&lt;/h3&gt;

&lt;p&gt;Understand authorization.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Service Container
&lt;/h3&gt;

&lt;p&gt;This is one of Laravel's most important architectural concepts.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. Dependency Injection
&lt;/h3&gt;

&lt;p&gt;Understand how Laravel resolves dependencies.&lt;/p&gt;

&lt;h3&gt;
  
  
  8. Jobs and Queues
&lt;/h3&gt;

&lt;p&gt;Especially if you're building production applications.&lt;/p&gt;

&lt;h3&gt;
  
  
  9. Events and Listeners
&lt;/h3&gt;

&lt;p&gt;Learn how to decouple secondary operations from your main application flow.&lt;/p&gt;

&lt;h3&gt;
  
  
  10. Artisan
&lt;/h3&gt;

&lt;p&gt;You'll use it constantly.&lt;/p&gt;




&lt;h1&gt;
  
  
  34. The Mental Model I Recommend
&lt;/h1&gt;

&lt;p&gt;If you're transitioning from Django, remember this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                       LARAVEL

                         Request
                            |
                            v
                       Middleware
                            |
                            v
                          Route
                            |
                            v
                       Controller
                            |
                 +----------+----------+
                 |                     |
                 v                     v
          Form Request             Policy
          Validation            Authorization
                 |
                 v
               Service
                 |
                 v
              Eloquent
                 |
                 v
              Database
                 |
                 v
              Resource
                 |
                 v
            JSON Response
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You don't have to use every box in every request.&lt;/p&gt;

&lt;p&gt;A simple endpoint might be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Request
   ↓
Route
   ↓
Controller
   ↓
Model
   ↓
Response
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A more complex endpoint might be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Request
   ↓
Middleware
   ↓
Route
   ↓
Form Request
   ↓
Policy
   ↓
Controller
   ↓
Service
   ↓
Eloquent
   ↓
Event
   ↓
Job
   ↓
Resource
   ↓
Response
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The architecture grows with the complexity of the application.&lt;/p&gt;




&lt;h1&gt;
  
  
  35. Final Thoughts
&lt;/h1&gt;

&lt;p&gt;Moving from Django to Laravel isn't really starting over.&lt;/p&gt;

&lt;p&gt;If you've already built applications with Django, you already understand most of the important backend concepts.&lt;/p&gt;

&lt;p&gt;You know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTTP&lt;/li&gt;
&lt;li&gt;Routing&lt;/li&gt;
&lt;li&gt;REST APIs&lt;/li&gt;
&lt;li&gt;Models&lt;/li&gt;
&lt;li&gt;ORMs&lt;/li&gt;
&lt;li&gt;Databases&lt;/li&gt;
&lt;li&gt;Relationships&lt;/li&gt;
&lt;li&gt;Migrations&lt;/li&gt;
&lt;li&gt;Authentication&lt;/li&gt;
&lt;li&gt;Authorization&lt;/li&gt;
&lt;li&gt;Middleware&lt;/li&gt;
&lt;li&gt;Validation&lt;/li&gt;
&lt;li&gt;Serialization&lt;/li&gt;
&lt;li&gt;Background tasks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Laravel simply implements many of these ideas differently.&lt;/p&gt;

&lt;p&gt;The biggest shift is learning Laravel's way of organizing those responsibilities.&lt;/p&gt;

&lt;p&gt;Instead of thinking:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Where is the Laravel version of my Django file?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;start thinking:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"What responsibility am I trying to solve, and which Laravel component is designed for it?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Once you start thinking that way, Laravel becomes much easier to understand.&lt;/p&gt;

&lt;p&gt;And if you've already built a Django REST API, you're not beginning your Laravel journey as a beginner.&lt;/p&gt;

&lt;p&gt;You're learning a &lt;strong&gt;new ecosystem using knowledge you already have&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The fastest way to make the transition stick is to build something you already understand in Django.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Landlord/Tenant API
       |
       +-- Authentication
       +-- Users
       +-- Properties
       +-- Bookings
       +-- Rent Payments
       +-- Maintenance Tickets
       +-- Roles
       +-- Authorization
       +-- Notifications
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Build the same system in Laravel while consciously mapping:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Django              Laravel

urls.py          →  routes
views.py         →  controllers
models.py        →  Eloquent models
DRF serializers  →  requests/resources
ORM              →  Eloquent
middleware       →  middleware
manage.py        →  Artisan
Celery           →  Jobs/Queues
settings.py      →  config + .env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's when Laravel stops looking like a completely different framework and starts becoming another way of solving problems you already know how to solve.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>laravel</category>
      <category>programming</category>
      <category>php</category>
    </item>
    <item>
      <title>Fixing PDO::MYSQL_ATTR_SSL_CA Deprecation Errors in PHP 8.5 and Laravel</title>
      <dc:creator>Vincent Tommi</dc:creator>
      <pubDate>Wed, 02 Sep 2026 20:33:59 +0000</pubDate>
      <link>https://dev.to/vincenttommi/fixing-pdomysqlattrsslca-deprecation-errors-in-php-85-and-laravel-48ng</link>
      <guid>https://dev.to/vincenttommi/fixing-pdomysqlattrsslca-deprecation-errors-in-php-85-and-laravel-48ng</guid>
      <description>&lt;p&gt;If you've recently upgraded to &lt;strong&gt;PHP 8.5&lt;/strong&gt; and started seeing deprecation warnings in a Laravel application, you may run into an error similar to this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Deprecated: Constant PDO::MYSQL_ATTR_SSL_CA is deprecated since 8.5,
use Pdo\Mysql::ATTR_SSL_CA instead
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In my case, the warning was pointing to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;config/database.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;at line 62.&lt;/p&gt;

&lt;p&gt;Here's how I fixed it and what I learned along the way.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;After upgrading to PHP 8.5, I ran:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan config:clear
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of clearing the configuration cache, Laravel returned:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Deprecated: Constant PDO::MYSQL_ATTR_SSL_CA is deprecated since 8.5,
use Pdo\Mysql::ATTR_SSL_CA instead

In database.php line 62:
Undefined constant PDO::mysql_ATTR_SSL_CA
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The important part is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Undefined constant PDO::mysql_ATTR_SSL_CA
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This happened because the constant had been changed incorrectly.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Old Constant
&lt;/h2&gt;

&lt;p&gt;Older PHP versions commonly use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="no"&gt;PDO&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;MYSQL_ATTR_SSL_CA&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;PHP 8.5 deprecates this form and recommends the MySQL-specific class instead.&lt;/p&gt;

&lt;p&gt;The new form is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Pdo\Mysql&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;ATTR_SSL_CA&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice that PHP class and constant names are case-sensitive.&lt;/p&gt;

&lt;h3&gt;
  
  
  Incorrect
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="no"&gt;PDO&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;mysql_ATTR_SSL_CA&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Correct
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Pdo\Mysql&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;ATTR_SSL_CA&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The difference is important:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PDO::mysql_ATTR_SSL_CA
^^^  ^^^^^^^^^^^^^^^

Pdo\Mysql::ATTR_SSL_CA
^^^  ^^^^^ ^^^^^^^^^
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Fixing &lt;code&gt;database.php&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Open your Laravel project's database configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;config/database.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Look for:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="no"&gt;PDO&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;MYSQL_ATTR_SSL_CA&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace it with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Pdo\Mysql&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;ATTR_SSL_CA&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example, if you have:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="s1"&gt;'options'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;extension_loaded&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'pdo_mysql'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="nb"&gt;array_filter&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="no"&gt;PDO&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;MYSQL_ATTR_SSL_CA&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'MYSQL_ATTR_SSL_CA'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[],&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;change it to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="s1"&gt;'options'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;extension_loaded&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'pdo_mysql'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="nb"&gt;array_filter&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="nc"&gt;Pdo\Mysql&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;ATTR_SSL_CA&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'MYSQL_ATTR_SSL_CA'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[],&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What If You Can't Edit the File With Nano?
&lt;/h2&gt;

&lt;p&gt;If you're using Ubuntu and &lt;code&gt;nano&lt;/code&gt; isn't working for you, there are several alternatives.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using VS Code
&lt;/h3&gt;

&lt;p&gt;If VS Code is installed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;code config/database.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or use the full path:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;code /home/tommi/Desktop/Development/programmer/samupos/config/database.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then replace:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="no"&gt;PDO&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;MYSQL_ATTR_SSL_CA&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Pdo\Mysql&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;ATTR_SSL_CA&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Using the Terminal
&lt;/h3&gt;

&lt;p&gt;If you only need to replace the constant, you can use &lt;code&gt;sed&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sed&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="s1"&gt;'s/PDO::mysql_ATTR_SSL_CA/Pdo\\Mysql::ATTR_SSL_CA/g'&lt;/span&gt; config/database.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you get a permission error, you can use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo sed&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="s1"&gt;'s/PDO::mysql_ATTR_SSL_CA/Pdo\\Mysql::ATTR_SSL_CA/g'&lt;/span&gt; config/database.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then verify the change:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; &lt;span class="s2"&gt;"SSL_CA"&lt;/span&gt; config/database.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Pdo\Mysql&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;ATTR_SSL_CA&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Verify That PHP Supports the New Constant
&lt;/h2&gt;

&lt;p&gt;Before trying Laravel again, you can check whether PHP recognizes the new constant:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php &lt;span class="nt"&gt;-r&lt;/span&gt; &lt;span class="s1"&gt;'var_dump(Pdo\Mysql::ATTR_SSL_CA);'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If everything is working correctly, PHP should return an integer value.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int(10023)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The exact integer isn't the important part. What matters is that PHP recognizes the constant without throwing an error.&lt;/p&gt;

&lt;h2&gt;
  
  
  Clear Laravel's Configuration Cache
&lt;/h2&gt;

&lt;p&gt;Once the constant has been corrected, go back to your Laravel project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; /home/tommi/Desktop/Development/programmer/samupos
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan config:clear
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also rebuild the configuration cache:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan config:cache
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If those commands complete successfully, Laravel should no longer complain about:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PDO::MYSQL_ATTR_SSL_CA
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Another PHP 8.5 Warning
&lt;/h2&gt;

&lt;p&gt;During this process, I also encountered another warning:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Deprecated: Using null as an array offset is deprecated, use an empty string instead
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It pointed to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;vendor/laravel/framework/src/Illuminate/Log/LogManager.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a different issue from the PDO constant.&lt;/p&gt;

&lt;p&gt;It's important &lt;strong&gt;not to directly edit files inside &lt;code&gt;vendor/&lt;/code&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;vendor&lt;/code&gt; directory contains dependencies installed by Composer, so changes made there can be overwritten the next time you run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;composer &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;composer update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead, check your Laravel version:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and your PHP version:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you're running an older Laravel version with PHP 8.5, you may need to update Laravel or one of its dependencies to a version that properly supports PHP 8.5.&lt;/p&gt;

&lt;h2&gt;
  
  
  Don't Mix Ubuntu PPAs Just to Fix This
&lt;/h2&gt;

&lt;p&gt;Another potential problem I encountered while setting up PHP was an Ubuntu repository error involving the Ondřej PHP PPA:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;The repository 'https://ppa.launchpadcontent.net/ondrej/php/ubuntu resolute Release'
does not have a Release file.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you're running a newer Ubuntu release and the PPA doesn't provide packages for that release, don't simply change the distribution name in the repository from something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;resolute
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;noble
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;just to make &lt;code&gt;apt update&lt;/code&gt; work.&lt;/p&gt;

&lt;p&gt;Mixing packages from different Ubuntu releases can cause dependency problems.&lt;/p&gt;

&lt;p&gt;Instead, verify what PHP version and packages your current Ubuntu release provides.&lt;/p&gt;

&lt;h2&gt;
  
  
  Useful Diagnostic Commands
&lt;/h2&gt;

&lt;p&gt;When troubleshooting PHP and Laravel compatibility issues, these commands are useful:&lt;/p&gt;

&lt;h3&gt;
  
  
  Check PHP version
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Check Laravel version
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Check whether PDO MySQL is installed
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php &lt;span class="nt"&gt;-m&lt;/span&gt; | &lt;span class="nb"&gt;grep &lt;/span&gt;pdo_mysql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Expected output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pdo_mysql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Check the new PHP 8.5 constant
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php &lt;span class="nt"&gt;-r&lt;/span&gt; &lt;span class="s1"&gt;'var_dump(Pdo\Mysql::ATTR_SSL_CA);'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Find the SSL constant in Laravel's configuration
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; &lt;span class="s2"&gt;"SSL_CA"&lt;/span&gt; config/database.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Final Fix
&lt;/h2&gt;

&lt;p&gt;The key change is simply:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight diff"&gt;&lt;code&gt;&lt;span class="gd"&gt;- PDO::MYSQL_ATTR_SSL_CA
&lt;/span&gt;&lt;span class="gi"&gt;+ Pdo\Mysql::ATTR_SSL_CA
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then clear Laravel's configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan config:clear
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and, if necessary:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan config:cache
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;PHP upgrades can expose deprecated functionality that previously worked without any problems. PHP 8.5 is a good example of this: code using the old &lt;code&gt;PDO::MYSQL_ATTR_SSL_CA&lt;/code&gt; constant can start producing deprecation warnings.&lt;/p&gt;

&lt;p&gt;The important thing is to distinguish between a &lt;strong&gt;deprecation warning&lt;/strong&gt;, an &lt;strong&gt;actual PHP error&lt;/strong&gt;, and a &lt;strong&gt;framework compatibility problem&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For this particular issue, the solution is straightforward:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Pdo\Mysql&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;ATTR_SSL_CA&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;instead of:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="no"&gt;PDO&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;MYSQL_ATTR_SSL_CA&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And when another warning points into &lt;code&gt;vendor/&lt;/code&gt;, resist the temptation to edit the dependency directly. Check your Laravel and package versions first and upgrade them where appropriate.&lt;/p&gt;

&lt;p&gt;Hopefully this saves someone else a few minutes when upgrading a Laravel project to PHP 8.5.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>laravel</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Understanding the Laravel `config` Folder: What I'm Learning as a Beginner</title>
      <dc:creator>Vincent Tommi</dc:creator>
      <pubDate>Sat, 29 Aug 2026 11:58:51 +0000</pubDate>
      <link>https://dev.to/vincenttommi/understanding-the-laravel-config-folder-what-im-learning-as-a-beginner-33kd</link>
      <guid>https://dev.to/vincenttommi/understanding-the-laravel-config-folder-what-im-learning-as-a-beginner-33kd</guid>
      <description>&lt;p&gt;I'm currently learning Laravel, and one of the things that caught my attention was the &lt;code&gt;config&lt;/code&gt; folder.&lt;/p&gt;

&lt;p&gt;Coming from a backend development background, I wanted to understand what all those PHP files were doing instead of simply knowing that they "contain configuration."&lt;/p&gt;

&lt;p&gt;When I opened a fresh Laravel project, I found files like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;config/
├── app.php
├── auth.php
├── broadcasting.php
├── cache.php
├── concurrency.php
├── cors.php
├── database.php
├── filesystems.php
├── hashing.php
├── images.php
├── logging.php
├── mail.php
├── queue.php
├── services.php
├── session.php
└── view.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At first, it looked like a lot to understand.&lt;/p&gt;

&lt;p&gt;So I decided to go through them one by one and document what I'm learning. Hopefully, this can also help someone else who is starting with Laravel.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The exact configuration files can vary depending on your Laravel version and the packages installed in your application.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  What is the &lt;code&gt;config&lt;/code&gt; folder?
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;config&lt;/code&gt; directory contains PHP configuration files that control different parts of your Laravel application.&lt;/p&gt;

&lt;p&gt;You can think of it as the place where Laravel learns things like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How to connect to a database&lt;/li&gt;
&lt;li&gt;How authentication works&lt;/li&gt;
&lt;li&gt;How files are stored&lt;/li&gt;
&lt;li&gt;How emails are sent&lt;/li&gt;
&lt;li&gt;How caching works&lt;/li&gt;
&lt;li&gt;How sessions work&lt;/li&gt;
&lt;li&gt;How queues work&lt;/li&gt;
&lt;li&gt;How logging works&lt;/li&gt;
&lt;li&gt;How external services are configured&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The structure looks roughly like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Laravel Application
        |
        ↓
     config/
        |
   ┌────┼────┬────┬────┐
   ↓    ↓    ↓    ↓    ↓
  DB   Auth  Mail Cache Logging
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  1. &lt;code&gt;app.php&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;code&gt;app.php&lt;/code&gt; contains general configuration for your Laravel application.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="s1"&gt;'name'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'APP_NAME'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'Laravel'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;

    &lt;span class="s1"&gt;'env'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'APP_ENV'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'production'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;

    &lt;span class="s1"&gt;'debug'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'APP_DEBUG'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;

    &lt;span class="s1"&gt;'url'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'APP_URL'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'http://localhost'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;

    &lt;span class="s1"&gt;'timezone'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'UTC'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;

    &lt;span class="s1"&gt;'locale'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'en'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It can contain settings related to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Application name&lt;/li&gt;
&lt;li&gt;Environment&lt;/li&gt;
&lt;li&gt;Debug mode&lt;/li&gt;
&lt;li&gt;Application URL&lt;/li&gt;
&lt;li&gt;Timezone&lt;/li&gt;
&lt;li&gt;Locale&lt;/li&gt;
&lt;li&gt;Encryption&lt;/li&gt;
&lt;li&gt;Service providers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, in &lt;code&gt;.env&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;APP_NAME=MyApplication
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Laravel can retrieve that value using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'APP_NAME'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  My understanding
&lt;/h3&gt;

&lt;p&gt;I think of &lt;code&gt;app.php&lt;/code&gt; as:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;General settings for the Laravel application.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  2. &lt;code&gt;auth.php&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;The &lt;code&gt;auth.php&lt;/code&gt; file deals with &lt;strong&gt;authentication&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Authentication is basically answering the question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Who is this user?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This configuration can define things such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Authentication guards&lt;/li&gt;
&lt;li&gt;User providers&lt;/li&gt;
&lt;li&gt;User models&lt;/li&gt;
&lt;li&gt;Password reset configuration&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="s1"&gt;'providers'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="s1"&gt;'users'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s1"&gt;'driver'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'eloquent'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'model'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;App\Models\User&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;],&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This tells Laravel which model it should use when working with users.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User
  ↓
Login
  ↓
Authentication
  ↓
Authenticated request
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  My understanding
&lt;/h3&gt;

&lt;p&gt;I think of &lt;code&gt;auth.php&lt;/code&gt; as:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;How Laravel identifies and authenticates users.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  3. &lt;code&gt;broadcasting.php&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;The &lt;code&gt;broadcasting.php&lt;/code&gt; file is related to &lt;strong&gt;real-time events&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Broadcasting allows Laravel to send events from the server to clients in real time.&lt;/p&gt;

&lt;p&gt;For example, imagine a chat application:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User A sends message
        ↓
Laravel
        ↓
Broadcast event
        ↓
User B receives message
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This can be useful for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Chat applications&lt;/li&gt;
&lt;li&gt;Real-time notifications&lt;/li&gt;
&lt;li&gt;Live dashboards&lt;/li&gt;
&lt;li&gt;Real-time status updates&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you're building a simple CRUD API, you may not need to work with this configuration immediately.&lt;/p&gt;

&lt;h3&gt;
  
  
  My understanding
&lt;/h3&gt;

&lt;p&gt;I think of &lt;code&gt;broadcasting.php&lt;/code&gt; as:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Configuration for sending Laravel events to clients in real time.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  4. &lt;code&gt;cache.php&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;The &lt;code&gt;cache.php&lt;/code&gt; file controls Laravel's &lt;strong&gt;caching system&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Caching allows your application to temporarily store data so that it doesn't have to perform the same expensive operation repeatedly.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Cache&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;put&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'username'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'Vincent'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3600&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Laravel can work with different cache stores depending on your configuration.&lt;/p&gt;

&lt;p&gt;Examples include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;File&lt;/li&gt;
&lt;li&gt;Database&lt;/li&gt;
&lt;li&gt;Redis&lt;/li&gt;
&lt;li&gt;Array&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CACHE_STORE=redis
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  My understanding
&lt;/h3&gt;

&lt;p&gt;I think of &lt;code&gt;cache.php&lt;/code&gt; as:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Where and how Laravel stores cached data.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  5. &lt;code&gt;concurrency.php&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;The &lt;code&gt;concurrency.php&lt;/code&gt; file is related to Laravel's &lt;strong&gt;concurrency features&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Concurrency is about allowing multiple tasks to execute without unnecessarily waiting for each one to finish before starting the next.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Without concurrency:

Task A → Task B → Task C
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With concurrency:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Task A ─┐
Task B ─┼──→ Results
Task C ─┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This can be useful when an application needs to perform several independent operations.&lt;/p&gt;

&lt;p&gt;As I'm learning Laravel, this is one of the configuration files I'm treating as something to understand later rather than something I need to modify immediately.&lt;/p&gt;

&lt;h3&gt;
  
  
  My understanding
&lt;/h3&gt;

&lt;p&gt;I think of &lt;code&gt;concurrency.php&lt;/code&gt; as:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Configuration related to running multiple operations concurrently.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  6. &lt;code&gt;cors.php&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;CORS stands for &lt;strong&gt;Cross-Origin Resource Sharing&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This becomes especially important when you're building a separate frontend and backend.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Frontend
Next.js
http://localhost:3000

        ↓ API request

Backend
Laravel
http://localhost:8000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are different origins.&lt;/p&gt;

&lt;p&gt;The browser needs to know whether the frontend is allowed to communicate with the backend.&lt;/p&gt;

&lt;p&gt;The CORS configuration deals with things such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Allowed origins&lt;/li&gt;
&lt;li&gt;Allowed HTTP methods&lt;/li&gt;
&lt;li&gt;Allowed headers&lt;/li&gt;
&lt;li&gt;Credentials&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For an API, this is particularly important.&lt;/p&gt;

&lt;h3&gt;
  
  
  My understanding
&lt;/h3&gt;

&lt;p&gt;I think of &lt;code&gt;cors.php&lt;/code&gt; as:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Configuration that controls which origins are allowed to communicate with my Laravel application.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  7. &lt;code&gt;database.php&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;This is one of the configuration files I'm paying the most attention to because I recently connected Laravel to PostgreSQL.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;database.php&lt;/code&gt; file controls Laravel's &lt;strong&gt;database connections&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For example, a PostgreSQL connection may look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="s1"&gt;'pgsql'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="s1"&gt;'driver'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'pgsql'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'host'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'DB_HOST'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'127.0.0.1'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="s1"&gt;'port'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'DB_PORT'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'5432'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="s1"&gt;'database'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'DB_DATABASE'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'laravel'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="s1"&gt;'username'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'DB_USERNAME'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'root'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="s1"&gt;'password'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'DB_PASSWORD'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="p"&gt;],&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The actual values can come from &lt;code&gt;.env&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=laravel
DB_USERNAME=laravel_user
DB_PASSWORD=your_password
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The relationship can be understood like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.env
 ↓
config/database.php
 ↓
Laravel database layer
 ↓
PostgreSQL
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  My understanding
&lt;/h3&gt;

&lt;p&gt;I think of &lt;code&gt;database.php&lt;/code&gt; as:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;How Laravel connects to and communicates with databases.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  8. &lt;code&gt;filesystems.php&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;This file controls Laravel's &lt;strong&gt;file storage&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Imagine an application where users can upload:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Profile pictures&lt;/li&gt;
&lt;li&gt;Documents&lt;/li&gt;
&lt;li&gt;PDFs&lt;/li&gt;
&lt;li&gt;Product images&lt;/li&gt;
&lt;li&gt;Videos&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Laravel needs to know where those files should be stored.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Storage&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;put&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'documents/example.pdf'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$file&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The filesystem configuration determines which storage disk Laravel uses.&lt;/p&gt;

&lt;h3&gt;
  
  
  My understanding
&lt;/h3&gt;

&lt;p&gt;I think of &lt;code&gt;filesystems.php&lt;/code&gt; as:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Where and how Laravel stores files.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  9. &lt;code&gt;hashing.php&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;The &lt;code&gt;hashing.php&lt;/code&gt; file controls Laravel's &lt;strong&gt;hashing configuration&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Hashing is particularly important when dealing with passwords.&lt;/p&gt;

&lt;p&gt;You should never store passwords as plain text:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;password123
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead, the password is hashed before being stored:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;password123
      ↓
    Hash
      ↓
   Database
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Laravel supports hashing algorithms such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bcrypt&lt;/li&gt;
&lt;li&gt;Argon&lt;/li&gt;
&lt;li&gt;Argon2id&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  My understanding
&lt;/h3&gt;

&lt;p&gt;I think of &lt;code&gt;hashing.php&lt;/code&gt; as:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;How Laravel hashes sensitive data such as passwords.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  10. &lt;code&gt;images.php&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;The &lt;code&gt;images.php&lt;/code&gt; configuration file is related to &lt;strong&gt;image handling and processing&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This can become useful when an application needs to work with uploaded images.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Resizing images&lt;/li&gt;
&lt;li&gt;Processing images&lt;/li&gt;
&lt;li&gt;Optimizing images&lt;/li&gt;
&lt;li&gt;Converting images&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This might be useful in applications such as e-commerce platforms where users upload product images.&lt;/p&gt;

&lt;h3&gt;
  
  
  My understanding
&lt;/h3&gt;

&lt;p&gt;I think of &lt;code&gt;images.php&lt;/code&gt; as:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Configuration related to image processing.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  11. &lt;code&gt;logging.php&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;The &lt;code&gt;logging.php&lt;/code&gt; file controls Laravel's &lt;strong&gt;logging system&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Logs are extremely useful when debugging an application.&lt;/p&gt;

&lt;p&gt;Laravel can write logs to files such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;storage/logs/laravel.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also create your own logs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Log&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'User registered successfully'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Log&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Payment failed'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Laravel supports different logging channels.&lt;/p&gt;

&lt;h3&gt;
  
  
  My understanding
&lt;/h3&gt;

&lt;p&gt;I think of &lt;code&gt;logging.php&lt;/code&gt; as:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;How Laravel records application events, warnings, and errors.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;When debugging Laravel applications, I'll probably spend quite a lot of time looking at:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;storage/logs/laravel.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  12. &lt;code&gt;mail.php&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;The &lt;code&gt;mail.php&lt;/code&gt; file controls &lt;strong&gt;email configuration&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Laravel applications commonly need to send emails for things such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Password resets&lt;/li&gt;
&lt;li&gt;Email verification&lt;/li&gt;
&lt;li&gt;Booking confirmations&lt;/li&gt;
&lt;li&gt;Payment receipts&lt;/li&gt;
&lt;li&gt;Notifications&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, &lt;code&gt;.env&lt;/code&gt; might contain:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MAIL_MAILER=smtp
MAIL_HOST=smtp.example.com
MAIL_PORT=587
MAIL_USERNAME=your_username
MAIL_PASSWORD=your_password
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Laravel uses the mail configuration to determine how emails should be sent.&lt;/p&gt;

&lt;h3&gt;
  
  
  My understanding
&lt;/h3&gt;

&lt;p&gt;I think of &lt;code&gt;mail.php&lt;/code&gt; as:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;How Laravel sends emails.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  13. &lt;code&gt;queue.php&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;The &lt;code&gt;queue.php&lt;/code&gt; file controls Laravel's &lt;strong&gt;queue system&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Queues are useful for tasks that don't need to happen before the user receives a response.&lt;/p&gt;

&lt;p&gt;For example, sending an email could be handled in the background:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User registers
      ↓
Laravel creates account
      ↓
Email job added to queue
      ↓
Response returned
      ↓
Queue worker sends email
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User registers
      ↓
Create account
      ↓
Send email
      ↓
Wait...
      ↓
Return response
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Queues can improve application responsiveness.&lt;/p&gt;

&lt;h3&gt;
  
  
  My understanding
&lt;/h3&gt;

&lt;p&gt;I think of &lt;code&gt;queue.php&lt;/code&gt; as:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;How Laravel handles background jobs.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  14. &lt;code&gt;services.php&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;The &lt;code&gt;services.php&lt;/code&gt; file is commonly used for &lt;strong&gt;third-party services&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GitHub&lt;/li&gt;
&lt;li&gt;Google&lt;/li&gt;
&lt;li&gt;Stripe&lt;/li&gt;
&lt;li&gt;PayPal&lt;/li&gt;
&lt;li&gt;AWS&lt;/li&gt;
&lt;li&gt;External APIs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You might have configuration like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="s1"&gt;'github'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="s1"&gt;'client_id'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'GITHUB_CLIENT_ID'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="s1"&gt;'client_secret'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'GITHUB_CLIENT_SECRET'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="s1"&gt;'redirect'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'GITHUB_REDIRECT_URI'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="p"&gt;],&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The actual credentials would normally be stored in &lt;code&gt;.env&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GITHUB_CLIENT_ID=your_client_id
GITHUB_CLIENT_SECRET=your_client_secret
GITHUB_REDIRECT_URI=http://localhost:8000/auth/github/callback
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  My understanding
&lt;/h3&gt;

&lt;p&gt;I think of &lt;code&gt;services.php&lt;/code&gt; as:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Configuration for services outside the Laravel application.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  15. &lt;code&gt;session.php&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;The &lt;code&gt;session.php&lt;/code&gt; file controls Laravel's &lt;strong&gt;session management&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Sessions allow an application to remember information between HTTP requests.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User logs in
     ↓
Session created
     ↓
User visits another page
     ↓
Laravel knows the user
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Laravel can store sessions using different drivers.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SESSION_DRIVER=file
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SESSION_DRIVER=database
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  My understanding
&lt;/h3&gt;

&lt;p&gt;I think of &lt;code&gt;session.php&lt;/code&gt; as:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;How Laravel stores and manages user sessions.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  16. &lt;code&gt;view.php&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;The &lt;code&gt;view.php&lt;/code&gt; file contains configuration related to Laravel's &lt;strong&gt;views&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Laravel's traditional server-side frontend system uses Blade templates.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;resources/
└── views/
    ├── welcome.blade.php
    └── dashboard.blade.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The view configuration helps Laravel locate and work with these templates.&lt;/p&gt;

&lt;p&gt;If you're building a Laravel API without Blade, you may not interact with this file very often.&lt;/p&gt;

&lt;h3&gt;
  
  
  My understanding
&lt;/h3&gt;

&lt;p&gt;I think of &lt;code&gt;view.php&lt;/code&gt; as:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Configuration for Laravel's view system.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  Which Configuration Files Should I Learn First?
&lt;/h1&gt;

&lt;p&gt;As someone learning Laravel from a backend development perspective, I'm not trying to memorize everything at once.&lt;/p&gt;

&lt;p&gt;I'd prioritize them like this:&lt;/p&gt;

&lt;h3&gt;
  
  
  Learn first
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;app.php
auth.php
database.php
hashing.php
logging.php
services.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cache.php
cors.php
queue.php
session.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And later:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;broadcasting.php
concurrency.php
filesystems.php
images.php
mail.php
view.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This doesn't mean the second group is less important. It just means you don't need to understand every Laravel feature on day one.&lt;/p&gt;




&lt;h1&gt;
  
  
  &lt;code&gt;.env&lt;/code&gt; vs &lt;code&gt;config&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;This was one of the most important things for me to understand.&lt;/p&gt;

&lt;p&gt;Laravel has a &lt;code&gt;.env&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and a configuration directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;config/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;They work together, but they have different purposes.&lt;/p&gt;

&lt;p&gt;For example, &lt;code&gt;.env&lt;/code&gt; might contain:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=laravel
DB_USERNAME=laravel_user
DB_PASSWORD=your_password
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then &lt;code&gt;config/database.php&lt;/code&gt; reads those values:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="s1"&gt;'pgsql'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="s1"&gt;'driver'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'pgsql'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'host'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'DB_HOST'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'127.0.0.1'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="s1"&gt;'port'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'DB_PORT'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'5432'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="s1"&gt;'database'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'DB_DATABASE'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'laravel'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="s1"&gt;'username'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'DB_USERNAME'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'root'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="s1"&gt;'password'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'DB_PASSWORD'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="p"&gt;],&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So I think of it like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.env
  ↓
Environment-specific values
  ↓
config/*.php
  ↓
Laravel configuration
  ↓
Laravel application
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  &lt;code&gt;env()&lt;/code&gt; vs &lt;code&gt;config()&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;You'll see these two functions frequently when working with Laravel.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;env()&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;env()&lt;/code&gt; reads environment variables.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;APP_NAME=MyApplication
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can access it with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'APP_NAME'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;code&gt;config()&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;config()&lt;/code&gt; reads Laravel's configuration.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nf"&gt;config&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'app.name'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This can retrieve the application name configured in &lt;code&gt;config/app.php&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;A useful rule I'm learning is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Use &lt;code&gt;env()&lt;/code&gt; mainly inside configuration files, and use &lt;code&gt;config()&lt;/code&gt; in application code.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For example, in application code, prefer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nf"&gt;config&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'app.timezone'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;rather than repeatedly accessing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'APP_TIMEZONE'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Why &lt;code&gt;php artisan config:clear&lt;/code&gt; Is Important
&lt;/h1&gt;

&lt;p&gt;While setting up PostgreSQL, I ran into a situation where Laravel wasn't using the database configuration I expected.&lt;/p&gt;

&lt;p&gt;One command I learned about was:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan config:clear
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This clears Laravel's cached configuration.&lt;/p&gt;

&lt;p&gt;Laravel can cache configuration to improve performance, especially in production.&lt;/p&gt;

&lt;p&gt;If you change your &lt;code&gt;.env&lt;/code&gt; file and Laravel appears to be ignoring your changes, you can try:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan config:clear
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then test your application again.&lt;/p&gt;

&lt;p&gt;You can also rebuild the configuration cache with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan config:cache
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  A Simple Way to Remember the Files
&lt;/h1&gt;

&lt;p&gt;Here's how I'm currently thinking about the configuration files:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;File&lt;/th&gt;
&lt;th&gt;What it controls&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;app.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;General application settings&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;auth.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Authentication&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;broadcasting.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Real-time events&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;cache.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Caching&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;concurrency.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Concurrent execution&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;cors.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Cross-origin requests&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;database.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Database connections&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;filesystems.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;File storage&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;hashing.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Password/data hashing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;images.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Image processing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;logging.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Application logging&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;mail.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Email&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;queue.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Background jobs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;services.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Third-party services&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;session.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Sessions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;view.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Blade views&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h1&gt;
  
  
  Coming From Django?
&lt;/h1&gt;

&lt;p&gt;Since I also work with Django, comparing Laravel with Django helps me understand the concepts.&lt;/p&gt;

&lt;p&gt;The two frameworks aren't identical, but there are some useful similarities:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Laravel&lt;/th&gt;
&lt;th&gt;Django&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;.env&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Environment variables / &lt;code&gt;.env&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;config/app.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;settings.py&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;config/database.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;DATABASES&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;config/auth.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Authentication configuration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;config/filesystems.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Media/storage configuration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;config/mail.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Email settings&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;config/cache.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;CACHES&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;config/logging.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;LOGGING&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;config/session.php&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Session configuration&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Coming from Django, this comparison makes Laravel's structure a little easier for me to understand.&lt;/p&gt;




&lt;h1&gt;
  
  
  Final Thoughts
&lt;/h1&gt;

&lt;p&gt;I'm learning that I don't need to understand every Laravel configuration file immediately.&lt;/p&gt;

&lt;p&gt;The important thing is to understand &lt;strong&gt;why the files exist and when I might need them&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For backend development, the configuration files I'll probably interact with most often are:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;database.php
auth.php
app.php
cors.php
logging.php
queue.php
cache.php
services.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The more I build applications with Laravel, the more these configurations will start making sense through practical use.&lt;/p&gt;

&lt;p&gt;I'm sharing this as part of my Laravel learning journey. If you're also learning Laravel, hopefully this gives you a simple starting point for understanding what's inside the &lt;code&gt;config&lt;/code&gt; directory.&lt;/p&gt;

&lt;p&gt;And if I've misunderstood anything, feel free to correct me in the comments. That's part of learning.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>productivity</category>
      <category>oop</category>
    </item>
    <item>
      <title>Connecting Laravel to PostgreSQL on Ubuntu: A Beginner's Guide</title>
      <dc:creator>Vincent Tommi</dc:creator>
      <pubDate>Fri, 28 Aug 2026 12:55:12 +0000</pubDate>
      <link>https://dev.to/vincenttommi/connecting-laravel-to-postgresql-on-ubuntu-a-beginners-guide-a46</link>
      <guid>https://dev.to/vincenttommi/connecting-laravel-to-postgresql-on-ubuntu-a-beginners-guide-a46</guid>
      <description>&lt;p&gt;If you're building your first Laravel application and trying to connect it to PostgreSQL, you might run into an error like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SQLSTATE[08006] [7] connection to server at "127.0.0.1", port 5432 failed:
FATAL: password authentication failed for user "postgres"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I ran into this while setting up a fresh Laravel application on Linux.&lt;/p&gt;

&lt;p&gt;At first, I thought the problem was with Laravel, but the error actually tells us something useful: &lt;strong&gt;Laravel can reach PostgreSQL, but PostgreSQL is rejecting the database credentials.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this article, I'll walk through how to connect Laravel to PostgreSQL on Ubuntu, create a dedicated database user, configure Laravel, and troubleshoot authentication errors.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before starting, make sure you have the following installed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PHP&lt;/li&gt;
&lt;li&gt;Composer&lt;/li&gt;
&lt;li&gt;Laravel&lt;/li&gt;
&lt;li&gt;PostgreSQL&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can check your PHP installation with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check Composer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;composer &lt;span class="nt"&gt;-V&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And check PostgreSQL:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;psql &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also check whether PostgreSQL is running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl status postgresql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If PostgreSQL isn't running, start it with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl start postgresql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Create a Laravel Project
&lt;/h2&gt;

&lt;p&gt;If you don't already have a Laravel project, you can create one using Composer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;composer create-project laravel/laravel example-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then move into the project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;example-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Laravel stores environment-specific configuration in the &lt;code&gt;.env&lt;/code&gt; file.&lt;/p&gt;

&lt;h2&gt;
  
  
  Configure Laravel for PostgreSQL
&lt;/h2&gt;

&lt;p&gt;Open your &lt;code&gt;.env&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nano .env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For PostgreSQL, your database configuration should look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=laravel
DB_USERNAME=laravel_user
DB_PASSWORD=your_password
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are a few important things to notice here.&lt;/p&gt;

&lt;h3&gt;
  
  
  PostgreSQL uses port 5432
&lt;/h3&gt;

&lt;p&gt;PostgreSQL normally runs on:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;5432
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;MySQL commonly uses:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;3306
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So don't use &lt;code&gt;3306&lt;/code&gt; if you're connecting Laravel to PostgreSQL.&lt;/p&gt;

&lt;h3&gt;
  
  
  Laravel uses &lt;code&gt;pgsql&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;For PostgreSQL, Laravel expects:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DB_CONNECTION=pgsql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Not:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DB_CONNECTION=postgres
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What Does the Authentication Error Mean?
&lt;/h2&gt;

&lt;p&gt;When I first tested the connection, I used:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;psql &lt;span class="nt"&gt;-h&lt;/span&gt; 127.0.0.1 &lt;span class="nt"&gt;-U&lt;/span&gt; postgres &lt;span class="nt"&gt;-d&lt;/span&gt; postgres &lt;span class="nt"&gt;-W&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;PostgreSQL returned:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FATAL: password authentication failed for user "postgres"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This can be confusing when you're new to PostgreSQL.&lt;/p&gt;

&lt;p&gt;The important thing is that PostgreSQL is actually responding.&lt;/p&gt;

&lt;p&gt;The problem isn't that PostgreSQL can't be found.&lt;/p&gt;

&lt;p&gt;Instead, PostgreSQL is saying:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I found the server and the user, but the password provided for that user is incorrect.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So changing the host or port won't fix this particular error.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create a Dedicated PostgreSQL User
&lt;/h2&gt;

&lt;p&gt;Rather than using the PostgreSQL administrator account for Laravel, I decided to create a separate user specifically for the application.&lt;/p&gt;

&lt;p&gt;This is a better approach because your application doesn't need to connect using a PostgreSQL superuser.&lt;/p&gt;

&lt;p&gt;First, access PostgreSQL through the system &lt;code&gt;postgres&lt;/code&gt; account:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo&lt;/span&gt; &lt;span class="nt"&gt;-u&lt;/span&gt; postgres psql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see something similar to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;postgres=#
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You're now inside the PostgreSQL command-line interface.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create the Laravel User
&lt;/h2&gt;

&lt;p&gt;Create a new PostgreSQL user:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;USER&lt;/span&gt; &lt;span class="n"&gt;laravel_user&lt;/span&gt; &lt;span class="k"&gt;WITH&lt;/span&gt; &lt;span class="n"&gt;PASSWORD&lt;/span&gt; &lt;span class="s1"&gt;'your_secure_password'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;USER&lt;/span&gt; &lt;span class="n"&gt;laravel_user&lt;/span&gt; &lt;span class="k"&gt;WITH&lt;/span&gt; &lt;span class="n"&gt;PASSWORD&lt;/span&gt; &lt;span class="s1"&gt;'myStrongPassword123'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a real application, use a strong password and don't commit it to Git.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create the Laravel Database
&lt;/h2&gt;

&lt;p&gt;Now create the database and make the new user its owner:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;DATABASE&lt;/span&gt; &lt;span class="n"&gt;laravel&lt;/span&gt; &lt;span class="k"&gt;OWNER&lt;/span&gt; &lt;span class="n"&gt;laravel_user&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can check your databases with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see the &lt;code&gt;laravel&lt;/code&gt; database in the list.&lt;/p&gt;

&lt;h2&gt;
  
  
  Grant Permissions
&lt;/h2&gt;

&lt;p&gt;Connect to the Laravel database:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="k"&gt;c&lt;/span&gt; &lt;span class="n"&gt;laravel&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then grant the user access to the &lt;code&gt;public&lt;/code&gt; schema:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;GRANT&lt;/span&gt; &lt;span class="k"&gt;ALL&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="k"&gt;SCHEMA&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;laravel_user&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also grant privileges on existing tables and sequences:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;GRANT&lt;/span&gt; &lt;span class="k"&gt;ALL&lt;/span&gt; &lt;span class="k"&gt;PRIVILEGES&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="k"&gt;ALL&lt;/span&gt; &lt;span class="n"&gt;TABLES&lt;/span&gt; &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="k"&gt;SCHEMA&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;laravel_user&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;GRANT&lt;/span&gt; &lt;span class="k"&gt;ALL&lt;/span&gt; &lt;span class="k"&gt;PRIVILEGES&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="k"&gt;ALL&lt;/span&gt; &lt;span class="n"&gt;SEQUENCES&lt;/span&gt; &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="k"&gt;SCHEMA&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;laravel_user&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For future tables and sequences, you can set default privileges:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;ALTER&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="k"&gt;PRIVILEGES&lt;/span&gt; &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="k"&gt;SCHEMA&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt;
&lt;span class="k"&gt;GRANT&lt;/span&gt; &lt;span class="k"&gt;ALL&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;TABLES&lt;/span&gt; &lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;laravel_user&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;ALTER&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="k"&gt;PRIVILEGES&lt;/span&gt; &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="k"&gt;SCHEMA&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt;
&lt;span class="k"&gt;GRANT&lt;/span&gt; &lt;span class="k"&gt;ALL&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;SEQUENCES&lt;/span&gt; &lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;laravel_user&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you're finished, exit PostgreSQL:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="n"&gt;q&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Test the PostgreSQL Connection
&lt;/h2&gt;

&lt;p&gt;Before going back to Laravel, it's a good idea to test the database connection directly.&lt;/p&gt;

&lt;p&gt;Run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;psql &lt;span class="nt"&gt;-h&lt;/span&gt; 127.0.0.1 &lt;span class="nt"&gt;-U&lt;/span&gt; laravel_user &lt;span class="nt"&gt;-d&lt;/span&gt; laravel &lt;span class="nt"&gt;-W&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enter the password you created earlier.&lt;/p&gt;

&lt;p&gt;If the credentials are correct, you should get:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;laravel=&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is an important troubleshooting step.&lt;/p&gt;

&lt;p&gt;If the connection works here, you know PostgreSQL is correctly configured and you can focus on Laravel if another problem occurs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Update Laravel's &lt;code&gt;.env&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Now configure Laravel with the new PostgreSQL user:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=laravel
DB_USERNAME=laravel_user
DB_PASSWORD=myStrongPassword123
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace the password with the one you actually created.&lt;/p&gt;

&lt;h2&gt;
  
  
  Clear Laravel's Configuration Cache
&lt;/h2&gt;

&lt;p&gt;Laravel may still have the old database configuration cached.&lt;/p&gt;

&lt;p&gt;Run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan config:clear
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see something similar to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;INFO  Configuration cache cleared successfully.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Run the Migrations
&lt;/h2&gt;

&lt;p&gt;Now run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan migrate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If everything is configured correctly, Laravel should connect to PostgreSQL and create its migration tables.&lt;/p&gt;

&lt;p&gt;You should see output similar to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;INFO  Preparing database.

Creating migration table ................................ DONE

INFO  Running migrations.

0001_01_01_000000_create_users_table .................... DONE
0001_01_01_000001_create_cache_table .................... DONE
0001_01_01_000002_create_jobs_table ..................... DONE
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At this point, Laravel is successfully connected to PostgreSQL.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding the Setup
&lt;/h2&gt;

&lt;p&gt;The final setup looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Laravel Application
        |
        | PostgreSQL connection
        ↓
127.0.0.1:5432
        |
        ↓
PostgreSQL
        |
        ↓
laravel_user
        |
        ↓
laravel database
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And your &lt;code&gt;.env&lt;/code&gt; contains:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=laravel
DB_USERNAME=laravel_user
DB_PASSWORD=your_password
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Common Mistakes
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Using the MySQL port
&lt;/h3&gt;

&lt;p&gt;Don't use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DB_PORT=3306
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;for PostgreSQL.&lt;/p&gt;

&lt;p&gt;Use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DB_PORT=5432
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Using the wrong connection name
&lt;/h3&gt;

&lt;p&gt;Don't use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DB_CONNECTION=postgres
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DB_CONNECTION=pgsql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Using &lt;code&gt;root&lt;/code&gt; as the PostgreSQL username
&lt;/h3&gt;

&lt;p&gt;If you're coming from MySQL, you might be used to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DB_USERNAME=root
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;PostgreSQL commonly has an administrative user called:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;postgres
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, your Laravel application doesn't need to use the administrator account.&lt;/p&gt;

&lt;p&gt;A dedicated user such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;laravel_user
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;is a better choice.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Forgetting to clear Laravel's configuration
&lt;/h3&gt;

&lt;p&gt;If you change your &lt;code&gt;.env&lt;/code&gt; file and Laravel continues using the old configuration, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan config:clear
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then try:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan migrate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  5. Not testing PostgreSQL separately
&lt;/h3&gt;

&lt;p&gt;If Laravel gives you a database connection error, test PostgreSQL directly first:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;psql &lt;span class="nt"&gt;-h&lt;/span&gt; 127.0.0.1 &lt;span class="nt"&gt;-U&lt;/span&gt; laravel_user &lt;span class="nt"&gt;-d&lt;/span&gt; laravel &lt;span class="nt"&gt;-W&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If this fails, the problem is probably with PostgreSQL, the username, password, database, or permissions.&lt;/p&gt;

&lt;p&gt;If it succeeds, then you can focus on Laravel's configuration.&lt;/p&gt;

&lt;h2&gt;
  
  
  Troubleshooting Checklist
&lt;/h2&gt;

&lt;p&gt;Before running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan migrate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;make sure:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PostgreSQL is running&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;laravel&lt;/code&gt; database exists&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;laravel_user&lt;/code&gt; exists&lt;/li&gt;
&lt;li&gt;The password is correct&lt;/li&gt;
&lt;li&gt;The user has access to the database&lt;/li&gt;
&lt;li&gt;PostgreSQL is running on port &lt;code&gt;5432&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;DB_CONNECTION=pgsql&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Laravel's configuration cache has been cleared&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan config:clear
php artisan migrate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Connecting Laravel to PostgreSQL for the first time can be confusing because there are several different pieces involved: Laravel, PHP, PostgreSQL, users, passwords, databases, ports, permissions, and environment variables.&lt;/p&gt;

&lt;p&gt;The biggest lesson I learned from this setup is that &lt;strong&gt;understanding the error is better than randomly changing configuration until something works.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For example, when you see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FATAL: password authentication failed for user "postgres"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;you already know that PostgreSQL is reachable. The problem is authentication.&lt;/p&gt;

&lt;p&gt;From there, you can test PostgreSQL independently, create a dedicated application user, verify the credentials, and then connect Laravel.&lt;/p&gt;

&lt;p&gt;Hopefully this guide helps another beginner who is setting up Laravel and PostgreSQL on Ubuntu for the first time.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>laravel</category>
      <category>php</category>
    </item>
    <item>
      <title>When Ubuntu Keyboard Shortcuts Stop Working: A Systematic GNOME Troubleshooting Guide</title>
      <dc:creator>Vincent Tommi</dc:creator>
      <pubDate>Fri, 14 Aug 2026 09:23:03 +0000</pubDate>
      <link>https://dev.to/vincenttommi/-when-ubuntu-keyboard-shortcuts-stop-working-a-systematic-gnome-troubleshooting-guide-59an</link>
      <guid>https://dev.to/vincenttommi/-when-ubuntu-keyboard-shortcuts-stop-working-a-systematic-gnome-troubleshooting-guide-59an</guid>
      <description>&lt;p&gt;Have you ever experienced a strange Ubuntu problem where your keyboard works perfectly, but your keyboard shortcuts suddenly stop working?&lt;/p&gt;

&lt;p&gt;That happened to me recently.&lt;/p&gt;

&lt;p&gt;I could type normally. Every key worked as expected. But keyboard shortcuts such as &lt;code&gt;Alt + Tab&lt;/code&gt;, &lt;code&gt;Ctrl + C&lt;/code&gt;, &lt;code&gt;Ctrl + V&lt;/code&gt;, and other combinations were not behaving as expected.&lt;/p&gt;

&lt;p&gt;At first, this looked like a keyboard problem.&lt;/p&gt;

&lt;p&gt;It wasn't.&lt;/p&gt;

&lt;p&gt;The keyboard was working properly. The problem was with the way Ubuntu/GNOME was handling shortcuts.&lt;/p&gt;

&lt;p&gt;This article explains how I approached the problem and the commands that can help diagnose similar issues.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. First, determine whether the keyboard or shortcuts are the problem
&lt;/h2&gt;

&lt;p&gt;The first mistake you can make when keyboard shortcuts stop working is assuming that the keyboard is broken.&lt;/p&gt;

&lt;p&gt;Before changing anything, test normal typing.&lt;/p&gt;

&lt;p&gt;Open a terminal and run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"keyboard test"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you can type normally, the keyboard hardware and basic input are probably working.&lt;/p&gt;

&lt;p&gt;This gives us an important distinction:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Keyboard input works
        ↓
Normal typing works
        ↓
Keyboard shortcuts fail
        ↓
Investigate the desktop/input configuration
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is much better than immediately reinstalling drivers or changing system configurations.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Test different types of shortcuts
&lt;/h2&gt;

&lt;p&gt;Not all keyboard shortcuts are handled by the same component.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;h3&gt;
  
  
  Application shortcuts
&lt;/h3&gt;

&lt;p&gt;These include:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Ctrl + C
Ctrl + V
Ctrl + Z
Ctrl + A
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are generally handled by the application.&lt;/p&gt;

&lt;h3&gt;
  
  
  Desktop/window-manager shortcuts
&lt;/h3&gt;

&lt;p&gt;Examples include:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Alt + Tab
Super
Ctrl + Alt + T
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These can be handled by GNOME, the window manager, or the desktop environment.&lt;/p&gt;

&lt;p&gt;This distinction is important when troubleshooting.&lt;/p&gt;

&lt;p&gt;If &lt;code&gt;Ctrl + C&lt;/code&gt; works in one application but &lt;code&gt;Alt + Tab&lt;/code&gt; doesn't work, the problem may be related specifically to GNOME's global shortcuts.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Check GNOME's shortcut configuration
&lt;/h2&gt;

&lt;p&gt;Ubuntu's GNOME desktop stores many shortcut configurations through &lt;code&gt;gsettings&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;For example, you can inspect the shortcut responsible for switching windows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gsettings get org.gnome.desktop.wm.keybindings switch-windows
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You may see something similar to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;['&amp;lt;Alt&amp;gt;Tab']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This tells you that GNOME has &lt;code&gt;Alt + Tab&lt;/code&gt; configured as a window-switching shortcut.&lt;/p&gt;

&lt;p&gt;You can also check application switching:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gsettings get org.gnome.desktop.wm.keybindings switch-applications
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the expected shortcut is missing or has been changed, GNOME's shortcut configuration may be the source of the problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Check GNOME Shell shortcuts
&lt;/h2&gt;

&lt;p&gt;Some shortcuts are handled directly by GNOME Shell.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gsettings get org.gnome.shell.keybindings show-applications
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This can help determine whether shortcuts involving the &lt;code&gt;Super&lt;/code&gt; key are configured correctly.&lt;/p&gt;

&lt;p&gt;The key idea is that instead of guessing, we can inspect the configuration directly.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Check Ubuntu's graphical shortcut settings
&lt;/h2&gt;

&lt;p&gt;You can also inspect shortcuts through the GUI.&lt;/p&gt;

&lt;p&gt;Go to:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Settings → Keyboard → View and Customize Shortcuts&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;From there, look at the configured shortcuts for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Windows&lt;/li&gt;
&lt;li&gt;Navigation&lt;/li&gt;
&lt;li&gt;Applications&lt;/li&gt;
&lt;li&gt;System&lt;/li&gt;
&lt;li&gt;Custom shortcuts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is useful because it allows you to verify the configuration without using the terminal.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Check accessibility features
&lt;/h2&gt;

&lt;p&gt;Another easy-to-miss cause is accessibility settings.&lt;/p&gt;

&lt;p&gt;Ubuntu provides features such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sticky Keys&lt;/li&gt;
&lt;li&gt;Slow Keys&lt;/li&gt;
&lt;li&gt;Bounce Keys&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If these have been enabled accidentally, keyboard behavior can become confusing.&lt;/p&gt;

&lt;p&gt;Go to:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Settings → Accessibility → Typing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;and check whether these features are enabled.&lt;/p&gt;

&lt;p&gt;If you don't intentionally use them, disable them and test the shortcuts again.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Check GNOME extensions
&lt;/h2&gt;

&lt;p&gt;GNOME extensions can also modify or intercept keyboard behavior.&lt;/p&gt;

&lt;p&gt;To see installed extensions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gnome-extensions list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you suspect an extension is causing the problem, temporarily disable it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gnome-extensions disable EXTENSION_NAME
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then test the shortcuts again.&lt;/p&gt;

&lt;p&gt;This is particularly useful if the problem started after installing or updating a GNOME extension.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Check whether Ubuntu is detecting the key combinations
&lt;/h2&gt;

&lt;p&gt;If the configuration appears correct but shortcuts still don't work, the next step is to determine whether the desktop is actually receiving the key events.&lt;/p&gt;

&lt;p&gt;One useful tool is &lt;code&gt;wev&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Install it with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;wev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Press keys such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Ctrl
Alt
Shift
Super
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and combinations such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Ctrl + C
Alt + Tab
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This helps determine whether the underlying input events are reaching the desktop environment.&lt;/p&gt;

&lt;p&gt;This is an important debugging principle:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Don't just ask whether a feature works. Determine which layer of the system is failing.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For keyboard shortcuts, the layers can look roughly like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Keyboard
   ↓
Linux input system
   ↓
Desktop environment
   ↓
GNOME Shell / Window Manager
   ↓
Application
   ↓
Shortcut
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finding the failing layer makes troubleshooting much easier.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. Don't immediately reset your configuration
&lt;/h2&gt;

&lt;p&gt;One tempting solution is to reset GNOME configuration immediately.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dconf reset &lt;span class="nt"&gt;-f&lt;/span&gt; /org/gnome/desktop/wm/keybindings/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This can be useful in some situations, but I wouldn't make it the first step.&lt;/p&gt;

&lt;p&gt;Why?&lt;/p&gt;

&lt;p&gt;Because resetting configuration can remove custom settings that you intentionally created.&lt;/p&gt;

&lt;p&gt;A better troubleshooting process is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. Confirm the keyboard works
2. Identify which shortcuts fail
3. Determine whether the problem is global or application-specific
4. Inspect GNOME shortcut configuration
5. Check accessibility settings
6. Check GNOME extensions
7. Inspect keyboard events
8. Reset configuration only if necessary
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This approach minimizes unnecessary changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  10. What I learned from the problem
&lt;/h2&gt;

&lt;p&gt;The most important lesson wasn't actually the command that fixed the shortcuts.&lt;/p&gt;

&lt;p&gt;It was the troubleshooting methodology.&lt;/p&gt;

&lt;p&gt;When something stops working, don't immediately assume the most obvious component is broken.&lt;/p&gt;

&lt;p&gt;In my case:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Keyboard works
      ↓
Typing works
      ↓
Shortcuts don't work
      ↓
Keyboard hardware is probably not the problem
      ↓
Investigate GNOME
      ↓
Inspect shortcut configuration
      ↓
Test the input events
      ↓
Identify the configuration/problem layer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This approach can be applied to much more than keyboard shortcuts.&lt;/p&gt;

&lt;p&gt;The same principle applies when debugging:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Django applications&lt;/li&gt;
&lt;li&gt;APIs&lt;/li&gt;
&lt;li&gt;databases&lt;/li&gt;
&lt;li&gt;Docker&lt;/li&gt;
&lt;li&gt;networking&lt;/li&gt;
&lt;li&gt;Linux services&lt;/li&gt;
&lt;li&gt;authentication&lt;/li&gt;
&lt;li&gt;frontend applications&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead of asking:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"What can I reinstall?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Ask:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Which layer is actually failing?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;A keyboard that works normally while its shortcuts fail doesn't necessarily indicate a hardware problem.&lt;/p&gt;

&lt;p&gt;On Ubuntu/GNOME, keyboard shortcuts involve several layers of configuration, including GNOME Shell, the window manager, applications, accessibility settings, and extensions.&lt;/p&gt;

&lt;p&gt;The best approach is therefore to troubleshoot systematically rather than immediately resetting or reinstalling components.&lt;/p&gt;

&lt;p&gt;The general debugging pattern is simple:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Observe
   ↓
Isolate
   ↓
Inspect
   ↓
Test
   ↓
Fix
   ↓
Verify
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That mindset is useful far beyond Linux desktop troubleshooting.&lt;/p&gt;

&lt;p&gt;Sometimes the best debugging tool isn't a complicated command.&lt;/p&gt;

&lt;p&gt;It's knowing &lt;strong&gt;which layer to investigate first&lt;/strong&gt;.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>ai</category>
      <category>productivity</category>
      <category>programming</category>
    </item>
    <item>
      <title>Git Merge vs Git Rebase: Understanding the Difference</title>
      <dc:creator>Vincent Tommi</dc:creator>
      <pubDate>Thu, 16 Jul 2026 17:47:59 +0000</pubDate>
      <link>https://dev.to/vincenttommi/git-merge-vs-git-rebase-understanding-the-difference-flf</link>
      <guid>https://dev.to/vincenttommi/git-merge-vs-git-rebase-understanding-the-difference-flf</guid>
      <description>&lt;p&gt;When collaborating on a Git project, one question comes up repeatedly:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Should you use &lt;code&gt;git merge&lt;/code&gt; or &lt;code&gt;git rebase&lt;/code&gt;?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The truth is that &lt;strong&gt;both commands achieve the same end goal&lt;/strong&gt;—they integrate changes from one branch into another. The key difference lies in &lt;strong&gt;how they handle your project's commit history&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Let's break it down.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is &lt;code&gt;git merge&lt;/code&gt;?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;git merge&lt;/code&gt; combines the histories of two branches while &lt;strong&gt;preserving the original branch structure&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Imagine you create a feature branch from &lt;code&gt;main&lt;/code&gt;, work on a new feature, and meanwhile other developers continue making changes to &lt;code&gt;main&lt;/code&gt;. When you're ready to integrate your work, running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout main
git merge feature-branch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;creates a &lt;strong&gt;merge commit&lt;/strong&gt; if both branches have diverged.&lt;/p&gt;

&lt;p&gt;Your Git history will clearly show:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Where the feature branch was created.&lt;/li&gt;
&lt;li&gt;The commits made on both branches.&lt;/li&gt;
&lt;li&gt;The point where the branches were merged back together.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This makes it easy to understand the evolution of a project, especially in teams where multiple developers are working simultaneously.&lt;/p&gt;

&lt;h3&gt;
  
  
  Advantages of Merge
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Preserves the complete project history.&lt;/li&gt;
&lt;li&gt;Never rewrites existing commits.&lt;/li&gt;
&lt;li&gt;Safe for shared branches.&lt;/li&gt;
&lt;li&gt;Makes collaboration easier because everyone keeps the same commit history.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  What is &lt;code&gt;git rebase&lt;/code&gt;?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;git rebase&lt;/code&gt; takes a different approach.&lt;/p&gt;

&lt;p&gt;Instead of creating a merge commit, Git &lt;strong&gt;replays your feature branch commits on top of the latest version of the target branch&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout feature-branch
git rebase main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Git temporarily removes your feature commits, updates your branch with the latest commits from &lt;code&gt;main&lt;/code&gt;, and then reapplies your work as &lt;strong&gt;new commits&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The result is a &lt;strong&gt;clean, linear commit history&lt;/strong&gt; that looks as if your work was built directly on top of the latest &lt;code&gt;main&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This makes the project history much easier to read.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Catch with Rebasing
&lt;/h2&gt;

&lt;p&gt;While rebasing creates a cleaner history, it comes with an important tradeoff.&lt;/p&gt;

&lt;p&gt;Because Git recreates your commits during the rebase process, &lt;strong&gt;each commit receives a new SHA (commit ID)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If you've already pushed those commits to a shared remote branch, rebasing changes history. You'll typically need to force-push your branch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git push &lt;span class="nt"&gt;--force-with-lease&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This can cause problems for teammates who already based their work on the original commits.&lt;/p&gt;

&lt;p&gt;That's why one of the most common Git recommendations is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Never rebase a branch that other people are actively using.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  When Should You Use Merge?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;git merge&lt;/code&gt; is usually the better choice when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Working on shared branches.&lt;/li&gt;
&lt;li&gt;Collaborating with multiple developers.&lt;/li&gt;
&lt;li&gt;Preserving the full history is important.&lt;/li&gt;
&lt;li&gt;You want to avoid rewriting commits.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Many teams configure pull requests to use merge commits because they're predictable and safe.&lt;/p&gt;




&lt;h2&gt;
  
  
  When Should You Use Rebase?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;git rebase&lt;/code&gt; shines when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You're working on your own feature branch.&lt;/li&gt;
&lt;li&gt;You want to clean up your commit history before opening a pull request.&lt;/li&gt;
&lt;li&gt;You prefer a linear Git history.&lt;/li&gt;
&lt;li&gt;You haven't shared your branch with others.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A common workflow is to regularly rebase your feature branch onto the latest &lt;code&gt;main&lt;/code&gt;, then merge it once it's ready.&lt;/p&gt;




&lt;h2&gt;
  
  
  Merge vs Rebase at a Glance
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Git Merge&lt;/th&gt;
&lt;th&gt;Git Rebase&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Preserves branch history&lt;/td&gt;
&lt;td&gt;Creates a linear history&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Creates a merge commit&lt;/td&gt;
&lt;td&gt;Does not create a merge commit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Safe for shared branches&lt;/td&gt;
&lt;td&gt;Rewrites commit history&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Keeps existing commit IDs&lt;/td&gt;
&lt;td&gt;Generates new commit IDs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Great for collaboration&lt;/td&gt;
&lt;td&gt;Great for cleaning up personal work&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Which One Should You Choose?
&lt;/h2&gt;

&lt;p&gt;There isn't a universally "better" command.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you're collaborating with others and want to preserve history, &lt;strong&gt;use &lt;code&gt;git merge&lt;/code&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;If you're polishing your own feature branch before merging, &lt;strong&gt;use &lt;code&gt;git rebase&lt;/code&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Many development teams actually use &lt;strong&gt;both&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Rebase&lt;/strong&gt; while working locally to keep your branch clean.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Merge&lt;/strong&gt; when integrating into shared branches to preserve collaboration history.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Understanding the strengths of each command will help you choose the right tool for the situation.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>git</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to Reset a Django Admin Password Using the Django Shell</title>
      <dc:creator>Vincent Tommi</dc:creator>
      <pubDate>Wed, 10 Dec 2025 04:42:03 +0000</pubDate>
      <link>https://dev.to/vincenttommi/how-to-reset-a-django-admin-password-using-the-django-shell-c59</link>
      <guid>https://dev.to/vincenttommi/how-to-reset-a-django-admin-password-using-the-django-shell-c59</guid>
      <description>&lt;p&gt;Forgetting the password for your Django admin account can be frustrating, but resetting it is quick and straightforward using the Django shell. This method works even if you no longer have access to the admin interface and doesn't require any additional packages.&lt;/p&gt;

&lt;p&gt;Step-by-Step Guide&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open the Django shell
In your project directory (where manage.py is located), run the following command:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python manage.py shell
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will start an interactive Python shell with your Django project loaded.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Reset the password
In the shell, execute the following code:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from django.contrib.auth.models import User

# Replace 'admin' with the actual username of the admin account
user = User.objects.get(username='admin')

# Set the new password (replace 'new_secure_password' with your desired password)
user.set_password('new_secure_password')

# Save the changes
user.save()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Important notes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use the correct username (it’s usually admin, but it could be something else if you created a custom superuser).&lt;/li&gt;
&lt;li&gt;set_password() automatically hashes the password for you—never use user.password = 'plain_text' as that would store the password unhashed.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Exit the shell
Once the password is updated, simply type:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;exit()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or press &lt;code&gt;Ctrl+D&lt;/code&gt; (on Unix-like systems) or &lt;code&gt;Ctrl+Z&lt;/code&gt; then Enter (on Windows).&lt;/p&gt;

&lt;p&gt;That’s it! You can now log in to the Django &lt;code&gt;admin&lt;/code&gt; interface (/admin/) using the &lt;code&gt;username&lt;/code&gt; and the new password you just set.&lt;br&gt;
Bonus: Resetting Password for Any User (Not Just Admin)&lt;br&gt;
The same method works for any user in your database. Just change the username to the correct one&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;user = User.objects.get(username='john_doe')
user.set_password('another_secure_password')
user.save()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Troubleshooting Tips&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;“User matching query does not exist”
Double-check the username (case-sensitive). You can list all users with:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User.objects.all()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Using a custom User model
If your project uses a custom user model (e.g., CustomUser), replace User with your model:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
from myapp.models import CustomUser
user = CustomUser.objects.get(username='admin')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Conclusion&lt;/p&gt;

&lt;p&gt;With just a few lines of code, you can regain access to your Django admin account in seconds. This technique is especially useful on production servers or when email-based password resets are not configured.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>backend</category>
      <category>programming</category>
    </item>
    <item>
      <title>How to Work on a Team with Git &amp; GitHub Without Breaking Everything</title>
      <dc:creator>Vincent Tommi</dc:creator>
      <pubDate>Tue, 09 Dec 2025 18:44:57 +0000</pubDate>
      <link>https://dev.to/vincenttommi/how-to-work-on-a-team-with-git-github-without-breaking-everything-17fo</link>
      <guid>https://dev.to/vincenttommi/how-to-work-on-a-team-with-git-github-without-breaking-everything-17fo</guid>
      <description>&lt;p&gt;The Definitive Guide Every Engineering Team Should Adopt&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Stop fighting over Git.&lt;/li&gt;
&lt;li&gt;Stop breaking main.&lt;/li&gt;
&lt;li&gt;Stop losing work.
This is the exact workflow used by high-performing teams at startups and scale-ups worldwide — simple enough for juniors, disciplined enough for staff engineers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Core Workflow (6 Commands to Rule Them All)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# 1. Safely stash your in-progress changes
git stash push -m "wip: halfway through payment UI"

# 2. Fetch and integrate the latest main
git pull origin main --rebase    # preferred over merge for clean history

# 3. Re-apply your work on top
git stash pop                    # resolves conflicts early

# 4. Stage changes
git add .

# 5. Write a meaningful commit message
git commit -m "feat: add real-time donation progress bar with percentage"

# 6. Push to remote
git push origin HEAD
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Daily &amp;amp; Hourly Discipline (Do This Religiously)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git stash
git pull origin main --rebase
git stash pop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Do this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First thing in the morning&lt;/li&gt;
&lt;li&gt;Before starting any new task&lt;/li&gt;
&lt;li&gt;After a teammate announces a hotfix&lt;/li&gt;
&lt;li&gt;Before pushing any commit&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This single habit eliminates 95% of merge conflicts&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pro-Level One-Liner (Add to Your Shell)&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# ~/.zshrc or ~/.bash_profile
alias sync="git stash push -m 'autosave $(date +%H:%M)' \
    &amp;amp;&amp;amp; git pull origin main --rebase \
    &amp;amp;&amp;amp; git stash pop"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now just run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sync
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Recommended Branching Strategy (Safe + Fast)&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Task Type&lt;/th&gt;
&lt;th&gt;Branch Name Example&lt;/th&gt;
&lt;th&gt;Workflow&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Hotfix / Urgent&lt;/td&gt;
&lt;td&gt;&lt;code&gt;hotfix/double-payment&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Direct to main (with PR)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Feature (&amp;gt;1 hour)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;feat/donation-progress-bar&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Branch → PR → Review → Merge&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bugfix&lt;/td&gt;
&lt;td&gt;&lt;code&gt;fix/invalid-goal-calculation&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Branch → PR&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Refactor / Chore&lt;/td&gt;
&lt;td&gt;&lt;code&gt;refactor/extract-payment-service&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Branch → PR&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Example: Start a proper feature branch
git pull origin main --rebase
git checkout -b feat/share-fundraiser-buttons
# ... work ...
git add .
git commit -m "feat: add social sharing for fundraisers"
git push -u origin feat/share-fundraiser-buttons
# → Open Pull Request on GitHub
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Conventional Commits (Your Team Will Thank You)&lt;br&gt;
Always use this format — enables auto-changelogs and clear history:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;feat:     Add new feature
fix:      Bug fix
docs:     Documentation only changes
style:    Formatting, missing semicolons, etc.
refactor: Code change that neither fixes a bug nor adds a feature
perf:     Performance improvements
test:     Adding or correcting tests
chore:    Build process or auxiliary tool changes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Examples:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git commit -m "feat: add fundraiser short link sharing"
git commit -m "fix: prevent negative donation amounts"
git commit -m "refactor: extract donation validation logic"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Conflict Resolution (When stash pop Fails)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git stash pop
# → Conflict in payments/views.py

# Fix the &amp;lt;&amp;lt;&amp;lt; === &amp;gt;&amp;gt;&amp;gt; markers manually
# Then:
git add payments/views.py
git commit  # no -m needed, Git creates merge commit message
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Golden Rules Every Team Member Must Follow&lt;/p&gt;

&lt;p&gt;1 Never commit directly to main (except hotfixes with approval)&lt;br&gt;
2 Always sync before starting work&lt;br&gt;
3 Always write descriptive commit messages&lt;br&gt;
4 Always push feature branches and open PRs&lt;br&gt;
5 Never force push main (or any shared branch)&lt;br&gt;
6 Rebase locally, merge on GitHub via PR (keeps history clean)&lt;/p&gt;

&lt;p&gt;Quick Reference Cheat Sheet (Pin This)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Stay in sync (run often)
sync                    # your alias
# or manually:
git stash &amp;amp;&amp;amp; git pull --rebase origin main &amp;amp;&amp;amp; git stash pop

# Ship completed work
git add .
git commit -m "type(scope): description"
git push

# Start new work safely
git pull --rebase origin main
git checkout -b feat/your-feature-name

# Emergency hotfix
git checkout main
git pull --rebase origin main
git checkout -b hotfix/critical-bug
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Final Words &lt;br&gt;
I’ve been on teams that lost entire days to merge conflicts.&lt;br&gt;
I’ve been on teams that deployed 20 times per day with zero drama.&lt;br&gt;
The difference was always this: discipline around syncing and branching.&lt;br&gt;
Adopt this workflow today.&lt;br&gt;
Enforce it in code reviews.&lt;br&gt;
Put it in your onboarding docs.&lt;br&gt;
Your future self — and every teammate who’s ever screamed at Git — will thank you.&lt;br&gt;
Now go forth and collaborate like professionals.&lt;br&gt;
Saved you from at least 47 rage-quits in 2025.&lt;br&gt;
You’re welcome. &lt;/p&gt;

</description>
      <category>webdev</category>
      <category>backend</category>
      <category>ai</category>
      <category>writing</category>
    </item>
    <item>
      <title>How to Build a Powerful &amp; Beginner-Friendly Django Admin</title>
      <dc:creator>Vincent Tommi</dc:creator>
      <pubDate>Tue, 25 Nov 2025 16:05:33 +0000</pubDate>
      <link>https://dev.to/vincenttommi/how-to-build-a-powerful-beginner-friendly-django-admin-4k0b</link>
      <guid>https://dev.to/vincenttommi/how-to-build-a-powerful-beginner-friendly-django-admin-4k0b</guid>
      <description>&lt;p&gt;A Step-by-Step Tutorial Using a Real-World Fundraising Platform&lt;br&gt;
Perfect for intermediate Django developers who want to go from “it works” to “this admin is actually amazing”.&lt;br&gt;
We’ll use a real crowdfunding/startup fundraising app (with individuals, NGOs, and startups) to teach you every important Django admin feature — with copy-paste code and clear explanations.&lt;br&gt;
By the end of this tutorial, you’ll know how to:&lt;/p&gt;

&lt;p&gt;Show custom model properties in the list view&lt;br&gt;
Add filters, search, and bulk edits&lt;br&gt;
Use inlines to edit related models on the same page&lt;br&gt;
Make the change-form beautiful with fieldsets and collapse sections&lt;br&gt;
Add custom columns with links and formatted money&lt;br&gt;
Write safe, performant querysets&lt;br&gt;
Add helpful readonly fields&lt;/p&gt;

&lt;p&gt;Let’s build it together!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# models.py (simplified)
class Fundraiser(models.Model):
    user = models.ForeignKey(User, on_delete=models.CASCADE, null=True)
    fundraising_category = models.ForeignKey(FundraisingCategory, ...)
    short_code = models.CharField(max_length=10, unique=True)
    is_approved = models.BooleanField(default=False)
    is_private = models.BooleanField(default=False)
    status = models.CharField(max_length=20, choices=STATUS_CHOICES, default='active')
    created_at = models.DateTimeField(auto_now_add=True)

    @property
    def raised_amount(self):
        return self.paystack_transactions.filter(status='success').aggregate(
            total=Sum('amount')
        )['total'] or 0

class FundraiserImage(models.Model):
    fundraiser = models.ForeignKey(Fundraiser, on_delete=models.CASCADE, related_name='images')
    image = models.ImageField(...)
    is_primary = models.BooleanField(default=False)

class IndividualDetail(models.Model):  # OneToOne with Fundraiser
    fundraiser = models.OneToOneField(Fundraiser, related_name='individual_detail', ...)
    fundraiser_title = models.CharField(...)
    fundraiser_goal = models.DecimalField(...)

# + OrganisationDetail and StartupDetail (also OneToOne)


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2: The Most Important Admin — FundraiserAdmin&lt;br&gt;
This will be your main dashboard.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# admin.py
from django.contrib import admin
from django.urls import reverse
from django.utils.html import format_html
from .models import Fundraiser, FundraiserImage, IndividualDetail, OrganisationDetail, StartupDetail


class FundraiserImageInline(admin.TabularInline):   # Step A: Inline images
    model = FundraiserImage
    extra = 1
    fields = ('name', 'image', 'is_primary')
    readonly_fields = ('file_size',)


@admin.register(Fundraiser)
class FundraiserAdmin(admin.ModelAdmin):
    # 1. What columns to show in the list
    list_display = (
        'short_code',
        'user',
        'category_colored',           # custom column (we'll write it)
        'raised_vs_goal',               # beautiful progress column
        'is_approved',
        'is_private',
        'status',
        'created_at',
    )

    # 2. Right sidebar filters
    list_filter = (
        'is_approved',
        'is_private',
        'status',
        'fundraising_category',
        'created_at',
    )

    # 3. Search box
    search_fields = ('short_code', 'user__email', 'user__username')

    # 4. Click the checkbox → edit these fields directly in place
    list_editable = ('is_approved', 'is_private', 'status')

    # 5. These fields are shown but not editable
    readonly_fields = ('short_code', 'created_at', 'updated_at')

    # 6. Inline images right on the same page
    inlines = [FundraiserImageInline]

    # 7. Default sorting
    ordering = ('-created_at',)

    # 8. Performance: avoid N+1 queries
    def get_queryset(self, request):
        return super().get_queryset(request).select_related(
            'user', 'fundraising_category'
        ).prefetch_related('paystack_transactions')

    # 9. Custom column: show category with color
    def category_colored(self, obj):
        color = {
            'Medical': 'crimson',
            'Education': 'royalblue',
            'Startup': 'green',
        }.get(obj.fundraising_category.name, 'gray')
        return format_html(
            '&amp;lt;span style="color: white; background:{}; padding: 2px 8px; border-radius: 4px;"&amp;gt;{}&amp;lt;/span&amp;gt;',
            color, obj.fundraising_category or "—"
        )
    category_colored.short_description = "Category"

    # 10. Custom column: $12,450 / $50,000 (54%)
    def raised_vs_goal(self, obj):
        goal = None
        if hasattr(obj, 'individual_detail'):
            goal = obj.individual_detail.fundraiser_goal
        elif hasattr(obj, 'organisation_details'):
            goal = obj.organisation_details.fundraiser_goal
        elif hasattr(obj, 'startup_detail'):
            goal = obj.startup_detail.fundraiser_goal

        if not goal:
            return "—"

        raised = obj.raised_amount
        percentage = (raised / goal * 100 if goal &amp;gt; 0 else 0

        return format_html(
            '&amp;lt;b&amp;gt;${:,.0f}&amp;lt;/b&amp;gt; → ${:,.0f} &amp;lt;small&amp;gt;({:.0f}%)&amp;lt;/small&amp;gt;',
            raised, goal, percentage
        )
    raised_vs_goal.short_description = "Raised / Goal"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result: Your admin list now looks professional and saves hours of clicking around.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Make Individual/Organisation/Startup Pages Beautiful&lt;br&gt;
Example: StartupDetailAdmin&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@admin.register(StartupDetail)
class StartupDetailAdmin(admin.ModelAdmin):
    list_display = ('startup_name', 'fundraiser_link', 'industry', 'stage', 'fundraiser_goal')
    list_filter = ('industry', 'stage', 'team_size')
    search_fields = ('startup_name', 'fundraiser__short_code')

    # Group fields nicely on the edit page
    fieldsets = (
        ("Linked Fundraiser", {
            'fields': ('fundraiser',),
            'description': 'This startup belongs to the fundraiser below'
        }),
        ("Startup Info", {
            'fields': ('startup_name', 'business_description', 'location', 'website')
        }),
        ("Fundraising", {
            'fields': ('fundraiser_title', 'fundraiser_details', 'fundraiser_goal')
        }),
        ("Classification", {
            'fields': ('industry', 'stage', 'team_size')
        }),
        ("Social Media (optional)", {
            'fields': ('social_media',),
            'classes': ('collapse',)  # collapsed by default
        }),
    )

    readonly_fields = ('created_at', 'updated_at')

    # Nice clickable link back to the main fundraiser
    def fundraiser_link(self, obj):
        url = reverse('admin:yourapp_fundraiser_change', args=[obj.fundraiser.id])
        return format_html('&amp;lt;a href="{}"&amp;gt;{} → View Fundraiser&amp;lt;/a&amp;gt;', url, obj.fundraiser.short_code)
    fundraiser_link.short_description = "Fundraiser"

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Do the same for IndividualDetailAdmin and OrganisationDetailAdmin — just change the fields.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4: Bonus — Useful Tricks Every Django Developer Should Know&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# 1. Custom bulk actions
def approve_selected(modeladmin, request, queryset):
    updated = queryset.update(is_approved=True)
    modeladmin.message_user(request, f"{updated} fundraisers approved!")
approve_selected.short_description = "Approve selected fundraisers"

FundraiserAdmin.actions = ['approve_selected']

# 2. Show image preview in list
def admin_image_preview(self, obj):
    if obj.image:
        return format_html('&amp;lt;img src="{}" width="80" height="50" style="object-fit: cover;"/&amp;gt;', obj.image.url)
    return "(No image)"
admin_image_preview.short_description = "Preview"

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Final Result&lt;br&gt;
You now have an admin that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Non-technical staff love using&lt;/li&gt;
&lt;li&gt;Shows real-time money raised&lt;/li&gt;
&lt;li&gt;Lets you approve 50 campaigns in 10 seconds&lt;/li&gt;
&lt;li&gt;Handles three different content types without confusion&lt;/li&gt;
&lt;li&gt;Looks clean and professional&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Copy the full final admin.py below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Full final admin.py (ready to copy-paste)
from django.contrib import admin
from django.db.models import Sum
from django.urls import reverse
from django.utils.html import format_html
from .models import (
    Fundraiser, FundraiserImage,
    IndividualDetail, OrganisationDetail, StartupDetail
)

class FundraiserImageInline(admin.TabularInline):
    model = FundraiserImage
    extra = 1
    fields = ('name', 'image', 'is_primary', 'file_size')
    readonly_fields = ('file_size',)

@admin.register(Fundraiser)
class FundraiserAdmin(admin.ModelAdmin):
    list_display = ('short_code', 'user', 'category_colored', 'raised_vs_goal',
                    'is_approved', 'is_private', 'status', 'created_at')
    list_filter = ('is_approved', 'is_private', 'status', 'fundraising_category')
    search_fields = ('short_code', 'user__email')
    list_editable = ('is_approved', 'is_private', 'status')
    readonly_fields = ('short_code', 'created_at', 'updated_at')
    inlines = [FundraiserImageInline]
    ordering = ('-created_at',)

    def get_queryset(self, request):
        return super().get_queryset(request).select_related(
            'user', 'fundraising_category'
        ).prefetch_related('paystack_transactions')

    def category_colored(self, obj):
        colors = {'Medical': 'crimson', 'Education': 'royalblue', 'Startup': 'green'}
        color = colors.get(obj.fundraising_category.name if obj.fundraising_category else '', 'gray')
        return format_html(
            '&amp;lt;span style="color:white; background:{}; padding:3px 8px; border-radius:4px;"&amp;gt;{}&amp;lt;/span&amp;gt;',
            color, obj.fundraising_category or "—"
        )
    category_colored.short_description = "Category"

    def raised_vs_goal(self, obj):
        # same as earlier — omitted for brevity
        pass
    raised_vs_goal.short_description = "Progress"

    def approve_selected(self, request, queryset):
        updated = queryset.update(is_approved=True)
        self.message_user(request, f"{updated} fundraisers approved.")
    approve_selected.short_description = "Approve selected"
    actions = ['approve_selected']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>webdev</category>
      <category>programming</category>
      <category>python</category>
      <category>performance</category>
    </item>
    <item>
      <title>Long Polling vs WebSockets — How to Achieve Real-Time Communication day 55 of system design</title>
      <dc:creator>Vincent Tommi</dc:creator>
      <pubDate>Mon, 13 Oct 2025 01:56:47 +0000</pubDate>
      <link>https://dev.to/vincenttommi/long-polling-vs-websockets-how-to-achieve-real-time-communication-day-55-of-system-design-1nhl</link>
      <guid>https://dev.to/vincenttommi/long-polling-vs-websockets-how-to-achieve-real-time-communication-day-55-of-system-design-1nhl</guid>
      <description>&lt;p&gt;Learn the key differences between Long Polling and WebSockets, how they work, and when to use each for real-time applications — with Python examples&lt;/p&gt;

&lt;p&gt;Whether you’re playing an online game or chatting with a friend — updates appear in &lt;em&gt;real-time&lt;/em&gt; without ever hitting “refresh.”&lt;/p&gt;

&lt;p&gt;Behind these seamless experiences lies a crucial engineering decision: &lt;strong&gt;how to push real-time updates from servers to clients&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The traditional HTTP model was built around request–response:  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Client asks, server answers.”  &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But in real-time systems, the &lt;strong&gt;server needs to talk first — and more often&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This is where &lt;strong&gt;Long Polling&lt;/strong&gt; and &lt;strong&gt;WebSockets&lt;/strong&gt; come in — two popular methods to achieve real-time communication on the web.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 1. Why Traditional HTTP Isn’t Enough
&lt;/h2&gt;

&lt;p&gt;HTTP follows a &lt;strong&gt;client-driven request–response&lt;/strong&gt; model:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The client (browser/app) sends a request to the server.
&lt;/li&gt;
&lt;li&gt;The server processes the request and responds.
&lt;/li&gt;
&lt;li&gt;The connection closes.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This works fine for static or on-demand content, but for live data:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;❌ The server can’t &lt;em&gt;push&lt;/em&gt; updates to the client.&lt;/li&gt;
&lt;li&gt;❌ HTTP is &lt;em&gt;stateless&lt;/em&gt;, so there’s no persistent connection.&lt;/li&gt;
&lt;li&gt;❌ You’d need constant polling to get new data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To build &lt;strong&gt;truly real-time experiences&lt;/strong&gt; — like live chat, multiplayer games, or financial tickers — we need a way for the server to instantly notify clients of updates.&lt;/p&gt;




&lt;h2&gt;
  
  
  ⏳ 2. Long Polling
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Long Polling&lt;/strong&gt; is a clever hack that &lt;em&gt;simulates&lt;/em&gt; real-time communication over standard HTTP.&lt;/p&gt;

&lt;p&gt;Instead of sending requests every second (like regular polling), the client &lt;strong&gt;sends a request and waits&lt;/strong&gt; — keeping the connection open until the server has something new to send.&lt;/p&gt;

&lt;h3&gt;
  
  
  ⚙️ How It Works
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Client sends a request and waits for new data.
&lt;/li&gt;
&lt;li&gt;The server &lt;strong&gt;holds the connection open&lt;/strong&gt; until it has data or a timeout occurs.
&lt;/li&gt;
&lt;li&gt;If new data arrives → server responds immediately.
&lt;/li&gt;
&lt;li&gt;If timeout occurs → server sends a minimal response.
&lt;/li&gt;
&lt;li&gt;The client &lt;strong&gt;immediately reopens&lt;/strong&gt; a new connection.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This creates a near-continuous loop that feels real-time.&lt;/p&gt;

&lt;h3&gt;
  
  
  ✅ Pros
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Simple to implement (standard HTTP).
&lt;/li&gt;
&lt;li&gt;Works everywhere — across proxies, firewalls, and browsers.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ❌ Cons
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Slight latency after each update (client must reconnect).
&lt;/li&gt;
&lt;li&gt;Server overhead (many open “hanging” connections).
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  💡 Use Cases
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Simple chat apps or comment feeds.
&lt;/li&gt;
&lt;li&gt;Notification systems (e.g., “new email” alerts).
&lt;/li&gt;
&lt;li&gt;Legacy systems that can’t use WebSockets.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  💻 Example (Python)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
python
import requests
import time

def long_poll():
    while True:
        try:
            response = requests.get("http://localhost:5000/updates", timeout=60)
            if response.status_code == 200 and response.text.strip():
                print("New data:", response.json())
            else:
                print("No new data, reconnecting...")
        except requests.exceptions.Timeout:
            print("Timeout reached, reconnecting...")
        except Exception as e:
            print("Error:", e)
            time.sleep(5)
        finally:
            # Immediately re-establish connection
            continue

if __name__ == "__main__":
    long_poll()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;WebSockets&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;WebSockets provide a persistent, full-duplex connection between the client and server — meaning both can send messages to each other at any time.&lt;/p&gt;

&lt;p&gt;This removes the overhead of repeatedly opening and closing HTTP connections.&lt;/p&gt;

&lt;p&gt;How It Works&lt;/p&gt;

&lt;p&gt;Handshake:&lt;br&gt;
The client sends an HTTP request with Upgrade: websocket.&lt;/p&gt;

&lt;p&gt;Connection Upgrade:&lt;br&gt;
The server switches from HTTP → WebSocket (ws:// or wss://).&lt;/p&gt;

&lt;p&gt;Persistent Channel:&lt;br&gt;
Both client and server can now exchange messages freely until the connection closes.&lt;/p&gt;

&lt;p&gt;✅ Pros&lt;/p&gt;

&lt;p&gt;Extremely low latency.&lt;/p&gt;

&lt;p&gt;Less network overhead (single persistent connection).&lt;/p&gt;

&lt;p&gt;Scales well for frequent or high-volume updates.&lt;/p&gt;

&lt;p&gt;❌ Cons&lt;/p&gt;

&lt;p&gt;Slightly more complex setup (client + server must support it).&lt;/p&gt;

&lt;p&gt;Some firewalls/proxies may block WebSocket traffic.&lt;/p&gt;

&lt;p&gt;Managing reconnections adds implementation complexity.&lt;/p&gt;

&lt;p&gt;💡 Use Cases&lt;/p&gt;

&lt;p&gt;Real-time chat and collaboration tools (Slack, Google Docs).&lt;/p&gt;

&lt;p&gt;Multiplayer online games.&lt;/p&gt;

&lt;p&gt;Live dashboards (sports, finance, IoT).&lt;/p&gt;

&lt;p&gt;Example of the above use cases&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import asyncio
import websockets
import json

async def connect():
    uri = "ws://localhost:6789"
    async with websockets.connect(uri) as websocket:
        await websocket.send(json.dumps({"message": "Hello Server!"}))
        print("Connected to server and sent greeting.")

        try:
            async for message in websocket:
                data = json.loads(message)
                print("Received:", data)
        except websockets.ConnectionClosed:
            print("Connection closed. Reconnecting...")
            await asyncio.sleep(2)
            await connect()

 4. Choosing the Right Approach

if __name__ == "__main__":
    asyncio.run(connect())
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Factor&lt;/th&gt;
&lt;th&gt;Long Polling&lt;/th&gt;
&lt;th&gt;WebSockets&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Implementation&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Simple (HTTP-based)&lt;/td&gt;
&lt;td&gt;Requires setup&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Performance&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Higher latency&lt;/td&gt;
&lt;td&gt;Near-zero latency&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Scalability&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Limited for many clients&lt;/td&gt;
&lt;td&gt;Scales efficiently&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Compatibility&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Works everywhere&lt;/td&gt;
&lt;td&gt;May need proxy support&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Use Case&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Notifications, light updates&lt;/td&gt;
&lt;td&gt;Real-time apps, games&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;🧩 5. Alternatives Worth Considering&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Server-Sent Events (SSE)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;One-way communication: server → client.&lt;/p&gt;

&lt;p&gt;Lightweight and simple for push notifications or news feeds.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;MQTT&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Publish–subscribe protocol used in IoT.&lt;/p&gt;

&lt;p&gt;Designed for lightweight, device-to-server messaging.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Socket.io&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Abstraction layer over WebSockets (and Long Polling fallback).&lt;/p&gt;

&lt;p&gt;Handles reconnections, fallbacks, and cross-browser quirks automatically.&lt;/p&gt;

&lt;p&gt;Final Thoughts&lt;/p&gt;

&lt;p&gt;While both Long Polling and WebSockets achieve “real-time” communication, the right choice depends on your project’s needs:&lt;/p&gt;

&lt;p&gt;Choose Long Polling when simplicity and broad compatibility matter.&lt;/p&gt;

&lt;p&gt;Choose WebSockets when performance, scalability, and bidirectional communication are key.&lt;/p&gt;

&lt;p&gt;Either way, both are essential tools in building modern, dynamic, and interactive web experiences. &lt;/p&gt;

</description>
      <category>programming</category>
      <category>systemdesign</category>
      <category>webdev</category>
      <category>python</category>
    </item>
    <item>
      <title>Concurrency vs Parallelism: Understanding the Difference with Examples day 54 of system design</title>
      <dc:creator>Vincent Tommi</dc:creator>
      <pubDate>Fri, 19 Sep 2025 08:47:42 +0000</pubDate>
      <link>https://dev.to/vincenttommi/concurrency-vs-parallelism-understanding-the-difference-with-examples-day-54-of-system-design-27bh</link>
      <guid>https://dev.to/vincenttommi/concurrency-vs-parallelism-understanding-the-difference-with-examples-day-54-of-system-design-27bh</guid>
      <description>&lt;p&gt;Concurrency and parallelism are two of the most misunderstood concepts in system design.&lt;/p&gt;

&lt;p&gt;While they might sound similar, they refer to fundamentally different approaches to handling tasks.&lt;/p&gt;

&lt;p&gt;Simply put:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Concurrency is about dealing with lots of things at once (task management).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Parallelism is about doing lots of things at once (task execution).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this article, we’ll break down the differences, explore how they work, and walk through real-world applications with examples and code.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What is Concurrency?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Concurrency means an application is making progress on more than one task at the same time.&lt;/p&gt;

&lt;p&gt;Even though a single CPU core can only execute one task at a time, it achieves concurrency by rapidly switching between tasks (context switching).&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Playing music while writing code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The CPU alternates between the two tasks so quickly that it feels like both are happening simultaneously.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But remember: this is not parallelism. This is concurrency.&lt;/p&gt;

&lt;p&gt;Real-World Examples&lt;/p&gt;

&lt;p&gt;Web Browsers: Rendering pages, fetching resources, responding to clicks.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Web Servers: Handling multiple requests at the same time.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Chat Apps: Sending/receiving messages, updating the UI.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Video Games: Rendering, physics, input handling, background music.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Code Example: Concurrency in Python (asyncio)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import asyncio

async def task(name):
    for i in range(1, 4):
        print(f"{name} - Step {i}")
        await asyncio.sleep(0.5)  # simulate I/O work

async def main():
    await asyncio.gather(
        task("Task A"),
        task("Task B"),
        task("Task C"),
    )

asyncio.run(main())
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output (interleaved execution):&lt;/p&gt;

&lt;p&gt;Task A - Step 1&lt;br&gt;
Task B - Step 1&lt;br&gt;
Task C - Step 1&lt;br&gt;
Task A - Step 2&lt;br&gt;
Task B - Step 2&lt;br&gt;
Task C - Step 2&lt;br&gt;
...&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What is Parallelism?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Parallelism means multiple tasks are executed at the exact same time.&lt;/p&gt;

&lt;p&gt;This requires multiple CPU cores or processors. Each task (or subtask) gets its own execution unit.&lt;/p&gt;

&lt;p&gt;Real-World Examples&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Machine Learning Training: Distribute dataset batches across GPUs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Video Rendering: Multiple frames processed simultaneously.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Web Crawlers: Fetch URLs in parallel.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Big Data: Distribute jobs across a cluster.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scientific Simulations: Weather modeling, physics simulations.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Code Example: Parallelism in Python (multiprocessing)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from multiprocessing import Pool
import time

def work(n):
    print(f"Processing {n}")
    time.sleep(1)  # simulate CPU work
    return n * n

if __name__ == "__main__":
    numbers = [1, 2, 3, 4]

    with Pool(processes=4) as pool:  # use 4 CPU cores
        results = pool.map(work, numbers)

    print("Results:", results)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output (executed in parallel):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Processing 1
Processing 2
Processing 3
Processing 4
Results: [1, 4, 9, 16]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, each task runs on a separate CPU core at the same time.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Concurrency vs Parallelism: Putting It All Together&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Concurrent, Not Parallel: Single-core CPU rapidly switching tasks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Parallel, Not Concurrent: One task split into subtasks, each core handles one.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Neither: Sequential execution, one task at a time.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Both: Multi-core CPU handling multiple concurrent tasks, each split into parallel subtasks.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Final Thoughts&lt;/p&gt;

&lt;p&gt;Concurrency = task management (making progress on many things).&lt;/p&gt;

&lt;p&gt;Parallelism = task execution (doing many things simultaneously).&lt;/p&gt;

&lt;p&gt;Most modern systems use both together for efficiency.&lt;/p&gt;

&lt;p&gt;Understanding these concepts helps you design scalable, efficient software — whether you're writing backend servers, training ML models, or building real-time apps.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>webdev</category>
      <category>python</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Vertical vs Horizontal Scaling: Choosing the Right Strategy for Your Application day 53 of system design</title>
      <dc:creator>Vincent Tommi</dc:creator>
      <pubDate>Thu, 18 Sep 2025 09:55:49 +0000</pubDate>
      <link>https://dev.to/vincenttommi/vertical-vs-horizontal-scaling-choosing-the-right-strategy-for-your-application-378a</link>
      <guid>https://dev.to/vincenttommi/vertical-vs-horizontal-scaling-choosing-the-right-strategy-for-your-application-378a</guid>
      <description>&lt;p&gt;As your application grows, it requires more resources to handle the increasing demand. To meet this challenge, two common strategies emerge: &lt;strong&gt;vertical scaling&lt;/strong&gt; (scaling up) and &lt;strong&gt;horizontal scaling&lt;/strong&gt; (scaling out).&lt;/p&gt;

&lt;p&gt;In this article, we’ll explore the pros and cons of both approaches and help you understand when to use one over the other.&lt;/p&gt;




&lt;h2&gt;
  
  
  Vertical Scaling (Scaling Up)
&lt;/h2&gt;

&lt;p&gt;Vertical scaling involves upgrading the resources of a single machine within your system. This can mean enhancing the CPU, RAM, storage, or other hardware components.&lt;/p&gt;

&lt;p&gt;Examples include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Upgrading CPU&lt;/strong&gt;: Replacing your server’s processor with a more powerful one.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Increasing RAM&lt;/strong&gt;: Adding more memory to process larger datasets efficiently.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enhancing Storage&lt;/strong&gt;: Using faster SSDs or increasing total storage capacity.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ✅ Pros
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Simplicity&lt;/strong&gt;: Easy to implement with minimal architectural changes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Low latency&lt;/strong&gt;: No inter-server communication needed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reduced software costs&lt;/strong&gt;: Often cheaper initially compared to scaling out.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No major code changes&lt;/strong&gt;: Works well without modifying your application significantly.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ❌ Cons
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Limited scalability&lt;/strong&gt;: There’s only so much you can upgrade a single machine.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Single point of failure&lt;/strong&gt;: If that server fails, the entire system can go down.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Downtime&lt;/strong&gt;: Hardware upgrades often require taking the system offline.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;High costs in the long run&lt;/strong&gt;: High-end servers become expensive quickly.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Horizontal Scaling (Scaling Out)
&lt;/h2&gt;

&lt;p&gt;Horizontal scaling involves adding more servers or nodes to the system and distributing the workload across them, often with a load balancer.&lt;/p&gt;

&lt;h3&gt;
  
  
  ✅ Pros
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Near-limitless scalability&lt;/strong&gt;: Add as many nodes as needed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Improved fault tolerance&lt;/strong&gt;: Failure of one node doesn’t crash the whole system.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost-effective hardware&lt;/strong&gt;: Uses multiple commodity servers instead of one expensive machine.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ❌ Cons
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Complexity&lt;/strong&gt;: Requires careful handling of data consistency, load balancing, and networking.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Increased latency&lt;/strong&gt;: Communication between nodes introduces overhead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Higher initial setup costs&lt;/strong&gt;: Infrastructure is more complex to maintain.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Application compatibility&lt;/strong&gt;: Some apps need code adjustments to run on distributed systems.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  When to Choose Vertical vs Horizontal Scaling
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Choose &lt;strong&gt;Vertical Scaling&lt;/strong&gt; when:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Your app has &lt;strong&gt;limited scalability needs&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;You’re working with &lt;strong&gt;legacy applications&lt;/strong&gt; that are hard to distribute.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Low latency&lt;/strong&gt; is critical.&lt;/li&gt;
&lt;li&gt;You’re on a &lt;strong&gt;cost-sensitive project&lt;/strong&gt; with minimal infrastructure budget.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Choose &lt;strong&gt;Horizontal Scaling&lt;/strong&gt; when:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;You anticipate &lt;strong&gt;rapid growth&lt;/strong&gt; in traffic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;High availability&lt;/strong&gt; is required.&lt;/li&gt;
&lt;li&gt;Your app can be &lt;strong&gt;easily distributed&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;You’re using a &lt;strong&gt;microservices architecture&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Cost-effectiveness with &lt;strong&gt;commodity hardware&lt;/strong&gt; is a priority.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Combining Vertical and Horizontal Scaling
&lt;/h2&gt;

&lt;p&gt;In many cases, the best solution is a &lt;strong&gt;hybrid approach&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Start by scaling vertically until you reach the limits of a single machine.&lt;/li&gt;
&lt;li&gt;Transition to horizontal scaling as demand grows further.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Vertically scaled clusters&lt;/strong&gt;: Each node is powerful, but the cluster scales horizontally.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Database sharding&lt;/strong&gt;: Data is spread across multiple servers (horizontal), with each server scaled vertically for performance.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;The choice between vertical and horizontal scaling depends on your &lt;strong&gt;application’s needs, growth expectations, budget, and uptime requirements&lt;/strong&gt;. Often, the most effective strategy is to combine both approaches: start with vertical scaling for simplicity and cost savings, then plan for horizontal scaling to ensure long-term scalability and resilience.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>webdev</category>
      <category>softwaredevelopment</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
