<?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: GAJALUXSAN</title>
    <description>The latest articles on DEV Community by GAJALUXSAN (@gajaluxsan).</description>
    <link>https://dev.to/gajaluxsan</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1203024%2Fafc2629c-6717-4fda-aa75-cf078a67fbb8.jpeg</url>
      <title>DEV Community: GAJALUXSAN</title>
      <link>https://dev.to/gajaluxsan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gajaluxsan"/>
    <language>en</language>
    <item>
      <title>Do users who use planning tools or features feel more productive in Cuser AI?</title>
      <dc:creator>GAJALUXSAN</dc:creator>
      <pubDate>Thu, 19 Mar 2026 16:57:35 +0000</pubDate>
      <link>https://dev.to/gajaluxsan/do-users-who-use-planning-tools-or-features-feel-more-productive-in-cuser-ai-3eh2</link>
      <guid>https://dev.to/gajaluxsan/do-users-who-use-planning-tools-or-features-feel-more-productive-in-cuser-ai-3eh2</guid>
      <description></description>
    </item>
    <item>
      <title>💥 Code breaks? Fix it faster with Sentry!</title>
      <dc:creator>GAJALUXSAN</dc:creator>
      <pubDate>Fri, 11 Jul 2025 06:21:13 +0000</pubDate>
      <link>https://dev.to/gajaluxsan/code-breaks-fix-it-faster-with-sentry-a7d</link>
      <guid>https://dev.to/gajaluxsan/code-breaks-fix-it-faster-with-sentry-a7d</guid>
      <description>&lt;p&gt;If you’re building a huge Laravel app, you need to know about this.&lt;/p&gt;

&lt;p&gt;In just 5 lines of code, Sentry starts monitoring your app for:&lt;br&gt;
◾ Errors &amp;amp;Crashes&lt;br&gt;
◾ Latency issues&lt;br&gt;
◾ Performance bottlenecks&lt;/p&gt;

&lt;p&gt;🔸 So you can catch problems before your users even notice — even in production.&lt;br&gt;
🔸 Actionable insights to fix Laravel performance bottlenecks and errors.&lt;br&gt;
🔸 Full release monitoring, so you can mark issues as resolved and stay focused on what’s live.&lt;/p&gt;

&lt;p&gt;Honestly, it’s a game-changer for big projects—especially if you’re working with microservices or high-traffic apps.&lt;/p&gt;

&lt;p&gt;Here’s why dev teams love it:&lt;br&gt;
 ⚡ Super simple setup — Install via Composer, plug in your DSN, done.&lt;br&gt;
 ⚡ Real-time alerts — Get notified instantly on Slack, Jira, email… whatever you use.&lt;br&gt;
⚡ N+1 query alerts → Automatically detect database inefficiencies&lt;br&gt;
 ⚡ Instant performance insights — Find N+1 DB queries, slow APIs &amp;amp; hidden bottlenecks.&lt;br&gt;
 ⚡ End-to-end visibility — Trace issues from frontend to backend, fast.&lt;br&gt;
 ⚡ Code-level profiling — See exactly which functions are slowing things down (flame charts included!).&lt;br&gt;
 ⚡ Health dashboards — Track your app’s key metrics like response time, error rate &amp;amp; more.&lt;/p&gt;

&lt;p&gt;It works great in production.&lt;br&gt;
You’ll catch issues early, speed up debugging, and keep your app running smoothly.&lt;/p&gt;

&lt;p&gt;⌛ Stop wasting time scrolling through endless logs.&lt;/p&gt;

&lt;p&gt;Let Sentry show you exactly what’s wrong — fast.&lt;br&gt;
👉 Thinking of leveling up your Laravel app? This might just be your smartest move.&lt;/p&gt;

&lt;p&gt;Level up your Laravel perf:&lt;br&gt;
🔗 &lt;a href="https://sentry.io/welcome" rel="noopener noreferrer"&gt;https://sentry.io/welcome&lt;/a&gt;&lt;br&gt;
🔗 &lt;a href="https://lnkd.in/gNRQ6yQS" rel="noopener noreferrer"&gt;https://lnkd.in/gNRQ6yQS&lt;/a&gt;&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>sentry</category>
      <category>testing</category>
      <category>api</category>
    </item>
    <item>
      <title>Understanding Polymorphic Relationships in Laravel (with Examples)</title>
      <dc:creator>GAJALUXSAN</dc:creator>
      <pubDate>Wed, 02 Jul 2025 05:35:34 +0000</pubDate>
      <link>https://dev.to/gajaluxsan/understanding-polymorphic-relationships-in-laravel-with-examples-2nlf</link>
      <guid>https://dev.to/gajaluxsan/understanding-polymorphic-relationships-in-laravel-with-examples-2nlf</guid>
      <description>&lt;p&gt;When building modern Laravel applications, sometimes you need to associate a single model with more than one other model. Instead of duplicating relationship code, polymorphic relationships offer a clean, flexible way to handle these situations.&lt;/p&gt;

&lt;p&gt;Let’s explore what polymorphic relationships are, how they work, and when to use them — with real-world code examples.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔍 What is a Polymorphic Relationship?
&lt;/h2&gt;

&lt;p&gt;In Eloquent ORM, a polymorphic relationship allows a model to belong to more than one other model using a single association.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; You want to allow both posts and videos to have comments.&lt;/p&gt;

&lt;p&gt;Rather than create two tables (&lt;code&gt;post_comments&lt;/code&gt;, &lt;code&gt;video_comments&lt;/code&gt;), you can use one &lt;code&gt;comments&lt;/code&gt; table with a polymorphic relationship.&lt;/p&gt;




&lt;h2&gt;
  
  
  🛠️ Setup: One-to-Many Polymorphic Relationship
&lt;/h2&gt;

&lt;p&gt;Let’s build the classic example of posts and videos sharing the comments model.&lt;/p&gt;

&lt;h3&gt;
  
  
  1️⃣ Create Migrations
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan make:model Post &lt;span class="nt"&gt;-m&lt;/span&gt;
php artisan make:model Video &lt;span class="nt"&gt;-m&lt;/span&gt;
php artisan make:model Comment &lt;span class="nt"&gt;-m&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;posts table&lt;/strong&gt;&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;'posts'&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;'title'&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;&lt;strong&gt;videos table&lt;/strong&gt;&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;'videos'&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;'url'&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;&lt;strong&gt;comments table&lt;/strong&gt;&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;'comments'&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;text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'body'&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;morphs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'commentable'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Creates commentable_id &amp;amp; commentable_type&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;h3&gt;
  
  
  2️⃣ Define Models and Relationships
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Comment.php&lt;/strong&gt;&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;Comment&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;commentable&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;morphTo&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;&lt;strong&gt;Post.php&lt;/strong&gt;&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;Post&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;comments&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;morphMany&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Comment&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;'commentable'&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;&lt;strong&gt;Video.php&lt;/strong&gt;&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;Video&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;comments&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;morphMany&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Comment&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;'commentable'&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;h3&gt;
  
  
  3️⃣ Usage Example
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Add a comment to a post&lt;/strong&gt;&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;$post&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Post&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;span class="nv"&gt;$post&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;comments&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;span class="s1"&gt;'body'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Nice article!'&lt;/span&gt;
&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Add a comment to a video&lt;/strong&gt;&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;$video&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Video&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;span class="nv"&gt;$video&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;comments&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;span class="s1"&gt;'body'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Awesome video!'&lt;/span&gt;
&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Get all comments of a post&lt;/strong&gt;&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;$post&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;comments&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Get the parent of a comment&lt;/strong&gt;&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;$comment&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Comment&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;span class="nv"&gt;$comment&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;commentable&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Returns Post or Video model&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🔁 Other Polymorphic Relationships
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;✅ &lt;strong&gt;One-to-One Polymorphic&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example: An Image model can belong to both User and Product.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ &lt;strong&gt;Many-to-Many Polymorphic&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example: A Tag model can be attached to both Posts and Videos.&lt;/p&gt;




&lt;h2&gt;
  
  
  🎯 When to Use Polymorphic Relationships
&lt;/h2&gt;

&lt;p&gt;Use polymorphic relationships when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Multiple models share a common child (e.g., comments, likes, tags).&lt;/li&gt;
&lt;li&gt;You want to avoid creating separate tables for each parent-child pair.&lt;/li&gt;
&lt;li&gt;You value clean, maintainable relationships in your codebase.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🧠 Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Polymorphic relationships are a powerful feature of Laravel’s Eloquent ORM. They simplify complex relationships and reduce duplication in your code. If you ever find yourself wanting multiple models to share a relationship, this is the tool for the job!&lt;/p&gt;

&lt;p&gt;Let me know if you want a deep dive into many-to-many polymorphic relationships or custom polymorphic morph maps in a future post! 🚀&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Laravel Tip: Automatically Set created_by with Model Events</title>
      <dc:creator>GAJALUXSAN</dc:creator>
      <pubDate>Mon, 23 Jun 2025 10:25:30 +0000</pubDate>
      <link>https://dev.to/gajaluxsan/laravel-tip-automatically-set-createdby-with-model-events-44m0</link>
      <guid>https://dev.to/gajaluxsan/laravel-tip-automatically-set-createdby-with-model-events-44m0</guid>
      <description>&lt;p&gt;Want to track who created or updated a record in Laravel? Try this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;protected static function booted()
{
    static::creating(function ($model) {
        $model-&amp;gt;created_by = auth()-&amp;gt;id();
    });
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>laravel</category>
      <category>php</category>
      <category>howto</category>
      <category>softwaredevelopment</category>
    </item>
  </channel>
</rss>
