<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Folarin Michael on Medium]]></title>
        <description><![CDATA[Stories by Folarin Michael on Medium]]></description>
        <link>https://medium.com/@createwithfola?source=rss-b6a2248d5d3e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*yAqtwNN4O6zHSL2cDztDlA.jpeg</url>
            <title>Stories by Folarin Michael on Medium</title>
            <link>https://medium.com/@createwithfola?source=rss-b6a2248d5d3e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 22:41:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@createwithfola/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Chaining Like a Boss: Mastering Eloquent in Laravel]]></title>
            <link>https://medium.com/@createwithfola/chaining-like-a-boss-mastering-eloquent-in-laravel-d402c016fcdd?source=rss-b6a2248d5d3e------2</link>
            <guid isPermaLink="false">https://medium.com/p/d402c016fcdd</guid>
            <dc:creator><![CDATA[Folarin Michael]]></dc:creator>
            <pubDate>Thu, 04 Sep 2025 20:54:29 GMT</pubDate>
            <atom:updated>2025-09-04T20:54:29.223Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/299/1*dk4oAsnMs9L5-v7yI5WtgQ.png" /><figcaption><strong>Chaining Like a Boss: Mastering Eloquent in Laravel</strong></figcaption></figure><p><strong>Chaining Like a Boss: Mastering Eloquent in Laravel</strong></p><p>When working with <strong>Laravel</strong>, one of its most elegant (pun intended) features is the <strong>Eloquent ORM</strong>. It lets you build database queries that are expressive, readable, and powerful — without sacrificing performance or maintainability.</p><p>But what truly elevates Eloquent is its ability to <strong>chain methods</strong>. Chaining transforms clunky, step-by-step logic into clean, fluent code that reads like natural language.</p><p>In this article, we’ll explore the art of Eloquent chaining — why it matters, practical examples, and pro tips to help you write queries like a boss.</p><p><strong>Why Chaining Matters</strong></p><p>Without chaining, your queries can quickly become verbose and fragmented. Let’s compare two approaches to the same query:</p><p><strong>Without chaining:</strong></p><blockquote>$users = User::where(‘status’, ‘active’);</blockquote><blockquote>$users = $users-&gt;where(‘role’, ‘admin’);</blockquote><blockquote>$users = $users-&gt;get();</blockquote><p><strong>With chaining:</strong></p><blockquote>$users = User::where(‘status’, ‘active’)</blockquote><blockquote>-&gt;where(‘role’, ‘admin’)</blockquote><blockquote>-&gt;get();</blockquote><p>The second version is not only shorter — it’s clearer. You understand the full intent at a glance.</p><p><strong>Common Chaining Patterns</strong></p><p><strong>1. Filtering with Multiple Conditions</strong></p><blockquote>$employees = Employee::where(‘department’, ‘IT’)</blockquote><blockquote>-&gt;where(‘status’, ‘active’)</blockquote><blockquote>-&gt;whereBetween(‘salary’, [50000, 100000])</blockquote><blockquote>-&gt;get();</blockquote><p>You don’t need loops or conditionals to express precise filters — Eloquent chaining makes it crystal clear.</p><p><strong>2. Sorting &amp; Limiting Results</strong></p><blockquote>$topProducts = Product::where(‘stock’, ‘&gt;’, 0)</blockquote><blockquote>-&gt;orderBy(‘sales’, ‘desc’)</blockquote><blockquote>-&gt;take(10)</blockquote><blockquote>-&gt;get();</blockquote><p>Perfect for dashboards and “Top 10” listings. Just one chain and done.</p><p><strong>3. Working with Relationships</strong></p><p>Eloquent shines when querying across relationships. Here’s how to get completed orders from <strong>premium customers</strong>:</p><blockquote>$orders = Order::with(‘customer’)</blockquote><blockquote>-&gt;whereHas(‘customer’, function($query) {</blockquote><blockquote>$query-&gt;where(‘status’, ‘premium’);</blockquote><blockquote>})</blockquote><blockquote>-&gt;where(‘status’, ‘completed’)</blockquote><blockquote>-&gt;orderBy(‘created_at’, ‘desc’)</blockquote><blockquote>-&gt;get();</blockquote><p>It reads like a sentence and handles complex joins under the hood.</p><p><strong>Pro Tips: Chaining Like a Boss</strong></p><p><strong>1. Use Scopes for Reusable Chains</strong></p><p>If you find yourself repeating the same conditions, extract them into <strong>query scopes</strong>.</p><blockquote>// In User.php model</blockquote><blockquote>public function scopeActive($query)</blockquote><blockquote>{</blockquote><blockquote>return $query-&gt;where(‘status’, ‘active’);</blockquote><blockquote>}</blockquote><p>Now, use it like this:</p><blockquote>$admins = User::active()-&gt;where(‘role’, ‘admin’)-&gt;get();</blockquote><p>Cleaner, reusable, and easy to test.</p><p><strong>2. Leverage Dynamic Where Methods</strong></p><blockquote>$user = User::whereEmail(‘john@example.com’)-&gt;first();</blockquote><p>Laravel turns whereXyz() into where(‘xyz’, …) automatically. It’s concise and semantic.</p><p><strong>3. Mix Eloquent with Query Builder When Needed</strong></p><p>Sometimes Eloquent isn’t flexible enough — especially for advanced reports. Mixing in the Query Builder gives you full control:</p><blockquote>$report = DB::table(‘orders’)</blockquote><blockquote>-&gt;join(‘users’, ‘orders.user_id’, ‘=’, ‘users.id’)</blockquote><blockquote>-&gt;where(‘orders.status’, ‘completed’)</blockquote><blockquote>-&gt;select(‘users.name’, DB::raw(‘COUNT(orders.id) as total_orders’))</blockquote><blockquote>-&gt;groupBy(‘users.name’)</blockquote><blockquote>-&gt;get();</blockquote><p>Don’t hesitate to blend both when performance or complexity demands it.</p><p><strong>4. Avoid N+1 Query Problems</strong></p><p>When loading related data, always use <strong>eager loading</strong> with with():</p><blockquote>$posts = Post::with(‘comments.user’)-&gt;get();</blockquote><p>Otherwise, you risk hitting the database <em>multiple times</em> per record — a silent performance killer.</p><p><strong>The Bigger Picture</strong></p><p>Chaining in Eloquent isn’t just about making your queries look pretty. It’s about writing <strong>expressive, maintainable, and scalable code</strong>.</p><p>When you chain like a boss, you:</p><ul><li>Reduce cognitive load for future developers (including future-you)</li><li>Prevent performance pitfalls like N+1 queries</li><li>Write DRY, self-documenting logic</li><li>Unlock the full potential of Laravel’s ORM</li></ul><p><strong>Final Takeaway</strong></p><p>Eloquent is named for a reason, it lets your database interactions be <strong>eloquent</strong>. And <strong>chaining</strong> is the brushstroke that turns SQL into art.</p><p>So the next time you write a query, ask yourself:</p><p>Am I chaining like a boss?</p><p><strong>Bonus: Resources &amp; Further Reading</strong></p><ul><li><a href="https://laravel.com/docs/eloquent?utm_source=chatgpt.com">Laravel Docs — Eloquent ORM</a></li><li><a href="https://laravel.com/docs/eloquent-relationships?utm_source=chatgpt.com#eager-loading">Understanding N+1 Queries</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d402c016fcdd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Learning to Code Is the New Superpower]]></title>
            <link>https://medium.com/@createwithfola/why-learning-to-code-is-the-new-superpower-4e1c06f730f4?source=rss-b6a2248d5d3e------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e1c06f730f4</guid>
            <dc:creator><![CDATA[Folarin Michael]]></dc:creator>
            <pubDate>Thu, 21 Aug 2025 09:13:52 GMT</pubDate>
            <atom:updated>2025-08-21T09:13:52.443Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>If you could wake up tomorrow with a superpower, what would it be? Flying? Time travel? Reading minds? For me, the most underrated superpower of our time is <strong>coding</strong>.</p><p>I will never forget when one of my coding students, Ayomide, who had only been learning for a few weeks, automated her monthly budget. What used to take her three hours was done in seconds. That’s the power of coding: solving real problems in smart, creative ways.</p><h3>Technology Is Everywhere</h3><p>Look around you. Almost everything in our daily lives runs on code. Your phone, the ATM, your car’s navigation system, even your fridge. All powered by lines of code written by someone.</p><p>And here’s the truth: you can be that “someone.”</p><h3>A Career That’s Growing Faster Than Ever</h3><p>Coding isn’t just fun — it opens doors. Jobs in software development are growing almost twice as fast as most other fields. And the pay? Many developers earn six figures, with room to grow even higher.</p><p>In other words, learning to code isn’t just about passion. It’s about securing a future where you can create opportunities for yourself instead of waiting for them.</p><h3>The Challenges Are Real — But So Are the Rewards</h3><p>Let’s be honest. Coding isn’t easy at first. Debugging errors can feel like solving a riddle in a language you barely understand. Writing your first program might feel frustrating.</p><p>But here’s the secret: every coder goes through that. And every error you fix is a small victory that makes you better.</p><p>Think of it like working out. The first push-up hurts, but over time you get stronger. Coding builds your brain the same way.</p><h3>Coding Is Creativity in Action</h3><p>A lot of people think coding is just math and logic. In reality, it’s closer to art. You’re not just writing lines of code — you’re creating solutions, building apps, designing websites, and shaping how people interact with technology.</p><p>Whether it’s building the next big social platform, creating an app that solves a problem in your community, or automating something in your daily life, coding gives you the power to turn imagination into reality.</p><h3>So, Where Do You Start?</h3><p>You don’t need to be a genius. You don’t need a degree. All you need is curiosity and the willingness to learn, one step at a time.</p><p>The only thing standing between you and this superpower is starting. So, open your laptop, write your first line of code, and begin building your future — one line at a time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e1c06f730f4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>