<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Blog Entries Tagged &#34;laravel&#34; on Milwaukee Web Developer, PHP and Laravel Programmer, Consultant</title>
    <link>https://aaronsaray.com/tag/laravel/</link>
    <description>Recent content in Blog Entries Tagged &#34;laravel&#34; on Milwaukee Web Developer, PHP and Laravel Programmer, Consultant</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <copyright>This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.</copyright>
    <lastBuildDate>Wed, 27 May 2026 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://aaronsaray.com/tag/laravel/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Why Do I Use Plain Text Password for My Initial User Record?</title>
      <link>https://aaronsaray.com/2026/why-do-i-use-plain-text-password-for-my-initial-user-record/</link>
      <pubDate>Wed, 27 May 2026 00:00:00 +0000</pubDate>
      <guid>https://aaronsaray.com/2026/why-do-i-use-plain-text-password-for-my-initial-user-record/</guid>
      <description>&lt;p&gt;When I create a project, I will have at least one user seeded into the database. This usually is an admin user as well.&lt;/p&gt;&#xA;&lt;p&gt;So, why would I create this user with a plain text password initially?! That&amp;rsquo;s crazy right?&lt;/p&gt;&#xA;&lt;p&gt;Let me explain why - and then you can see if you agree.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Validate Everything Including Pagination</title>
      <link>https://aaronsaray.com/2026/validate-everything-including-pagination/</link>
      <pubDate>Tue, 26 May 2026 00:00:00 +0000</pubDate>
      <guid>https://aaronsaray.com/2026/validate-everything-including-pagination/</guid>
      <description>&lt;p&gt;There are many reasons why we validate data - whether it&amp;rsquo;s a Laravel project or any other framework or technology. Sometimes it&amp;rsquo;s for user or business sanity, other times to keep the application functioning properly. We even do so for security - for both security attacks we know about and hopefully to stop ones we don&amp;rsquo;t understand.&lt;/p&gt;&#xA;&lt;p&gt;This is the reason why I reached for validation on pagination requests.  This is user input. Just because I don&amp;rsquo;t understand how it could hurt me doesn&amp;rsquo;t mean I should ignore it, right?&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s validate pagination - easily - in Laravel.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Laravel 201 Created JSON With Location Header</title>
      <link>https://aaronsaray.com/2026/laravel-201-created-json-with-location-header/</link>
      <pubDate>Thu, 12 Mar 2026 00:00:00 +0000</pubDate>
      <guid>https://aaronsaray.com/2026/laravel-201-created-json-with-location-header/</guid>
      <description>&lt;p&gt;Each API seems to be different. However, there are some best practices that we should all try to follow.&lt;/p&gt;&#xA;&lt;p&gt;One of those that I really like is the 201 Created HTTP response. If the object is created immediately, you may even return the full object contents.&lt;/p&gt;&#xA;&lt;p&gt;In some cases, we don&amp;rsquo;t have the data or don&amp;rsquo;t want to return the full payload. We can return null with a location header. Here&amp;rsquo;s how to do that with Laravel.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Using a Laravel Factory State to Add a Spatie Role</title>
      <link>https://aaronsaray.com/2026/using-a-laravel-factory-state-to-add-a-spatie-role/</link>
      <pubDate>Fri, 09 Jan 2026 00:00:00 +0000</pubDate>
      <guid>https://aaronsaray.com/2026/using-a-laravel-factory-state-to-add-a-spatie-role/</guid>
      <description>&lt;p&gt;I love the &lt;a href=&#34;https://spatie.be/docs/laravel-permission/v6/introduction&#34;&gt;Spatie Laravel Permissions&lt;/a&gt; package. I use it in almost all of my Laravel projects.&lt;/p&gt;&#xA;&lt;p&gt;When testing, I&amp;rsquo;ll need to set up users with various different roles and permissions. Usually, I&amp;rsquo;m using an Eloquent Factory in order to accomplish this.&lt;/p&gt;&#xA;&lt;p&gt;But it&amp;rsquo;s a little different when you&amp;rsquo;re dealing with relationships. Let&amp;rsquo;s find out how.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Customize Laravel Ide Helper to Autocomplete Blade Files</title>
      <link>https://aaronsaray.com/2025/customize-laravel-ide-helper-to-autocomplete-blade-files/</link>
      <pubDate>Wed, 17 Dec 2025 00:00:00 +0000</pubDate>
      <guid>https://aaronsaray.com/2025/customize-laravel-ide-helper-to-autocomplete-blade-files/</guid>
      <description>&lt;p&gt;I&amp;rsquo;m working with &lt;a href=&#34;https://github.com/yajra/laravel-datatables&#34;&gt;Yajra DataTables&lt;/a&gt; in a Laravel project and I&amp;rsquo;ve ran into a little bit of a headache. They provide their own &lt;code&gt;render()&lt;/code&gt; method, which you pass a blade file to as the first parameter. Something like &lt;code&gt;users.dogs.index&lt;/code&gt; - and through that mechanism it loads the proper blade for the datatable.&lt;/p&gt;&#xA;&lt;p&gt;Here&amp;rsquo;s the problem, though. I can&amp;rsquo;t get auto complete and I can&amp;rsquo;t click through on that in PHPStorm. But I want to. Let&amp;rsquo;s find out how.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Stopping Laravel SQL Injection with sole()</title>
      <link>https://aaronsaray.com/2025/stopping-laravel-sql-injection-with-sole/</link>
      <pubDate>Fri, 07 Nov 2025 00:00:00 +0000</pubDate>
      <guid>https://aaronsaray.com/2025/stopping-laravel-sql-injection-with-sole/</guid>
      <description>&lt;p&gt;I love using Eloquent&amp;rsquo;s &lt;code&gt;sole()&lt;/code&gt; method in Laravel. It throws an exception if the result set is ever more than 1. It means you should only have a sole record. This is usually what I want. I&amp;rsquo;ve migrated away from &lt;code&gt;firstOrFail()&lt;/code&gt; unless I legitimately want the first of a matching set.&lt;/p&gt;&#xA;&lt;p&gt;But I just found another reason to love using the sole method - it helps add a layer of protection against SQL injection. Let&amp;rsquo;s find out how.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Why You Might Want to Hydrate Models to Delete Them in Laravel</title>
      <link>https://aaronsaray.com/2025/why-you-might-want-to-hydrate-models-to-delete-them-in-laravel/</link>
      <pubDate>Wed, 15 Oct 2025 00:00:00 +0000</pubDate>
      <guid>https://aaronsaray.com/2025/why-you-might-want-to-hydrate-models-to-delete-them-in-laravel/</guid>
      <description>&lt;p&gt;There are many ways to handle cascading functionality in Laravel. You can do this with observers, events, manually dispatched jobs - even in MySQL with cascading deletes.&lt;/p&gt;&#xA;&lt;p&gt;I prefer to keep my cascading logic in the application code by using Eloquent Model Events. This is super easy when it&amp;rsquo;s just a single level of model. But what about relationships?&lt;/p&gt;</description>
    </item>
    <item>
      <title>Docker Healthcheck Values for Laravel Projects</title>
      <link>https://aaronsaray.com/2025/docker-healthcheck-values-for-laravel-projects/</link>
      <pubDate>Mon, 22 Sep 2025 00:00:00 +0000</pubDate>
      <guid>https://aaronsaray.com/2025/docker-healthcheck-values-for-laravel-projects/</guid>
      <description>&lt;p&gt;Docker provides the &lt;a href=&#34;https://docs.docker.com/reference/dockerfile/#healthcheck&#34;&gt;HEALTHCHECK&lt;/a&gt; instruction for Dockerfiles and Docker Compose files.&lt;/p&gt;&#xA;&lt;p&gt;While not absolutely required, configuring these can make your IDE and environment more robust and verbose.&lt;/p&gt;&#xA;&lt;p&gt;Here&amp;rsquo;s what I use with some common containers in Laravel projects.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Livewire 3 Reactive Event Dispatching</title>
      <link>https://aaronsaray.com/2025/livewire-3-reactive-event-dispatching/</link>
      <pubDate>Tue, 09 Sep 2025 00:00:00 +0000</pubDate>
      <guid>https://aaronsaray.com/2025/livewire-3-reactive-event-dispatching/</guid>
      <description>&lt;p&gt;Issuing events with Livewire is a useful way to communicate between components. But, there are some caveats to be aware of - especially if you&amp;rsquo;re coming from something like React or Vue. The majority of this comes from the fact that Livewire treats every component as an island.&lt;/p&gt;&#xA;&lt;p&gt;This had stumped me a few times in the past. Because of this, I wanted to give a quick example of how you can use Livewire events in a way that you might be more familiar with: with reactivity.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Rendering Json Exceptions in Laravel Before Version 11</title>
      <link>https://aaronsaray.com/2025/rendering-json-exceptions-in-laravel-before-version-11/</link>
      <pubDate>Tue, 12 Aug 2025 00:00:00 +0000</pubDate>
      <guid>https://aaronsaray.com/2025/rendering-json-exceptions-in-laravel-before-version-11/</guid>
      <description>&lt;p&gt;In Laravel 11+, it&amp;rsquo;s quite easy to tell the exception handler to render all (or a select portion of them) as JSON regardless of the request/response type. But what about earlier versions?&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
