<?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: Ariel Mejia</title>
    <description>The latest articles on DEV Community by Ariel Mejia (@arielmejiadev).</description>
    <link>https://dev.to/arielmejiadev</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%2F139950%2F632b5c6d-6c43-42ce-a534-da4d22bf92d2.png</url>
      <title>DEV Community: Ariel Mejia</title>
      <link>https://dev.to/arielmejiadev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/arielmejiadev"/>
    <language>en</language>
    <item>
      <title>Fix commond Laravel Horizon issues</title>
      <dc:creator>Ariel Mejia</dc:creator>
      <pubDate>Tue, 17 Jun 2025 21:00:56 +0000</pubDate>
      <link>https://dev.to/arielmejiadev/fix-commond-laravel-horizon-issues-2be3</link>
      <guid>https://dev.to/arielmejiadev/fix-commond-laravel-horizon-issues-2be3</guid>
      <description>&lt;p&gt;Ok you have some jobs to process in the background using Redis, the first problem that you can get is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;php_network_getaddresses: getaddrinfo for redis failed: nodename nor servname provided, or not known&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We are going to tackle this in different steps, first check if you have installed &lt;code&gt;Redis&lt;/code&gt; locally, in your terminal run:&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 1: Install Redis
&lt;/h2&gt;



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

&lt;/div&gt;



&lt;p&gt;Check Redis installation&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php -m | grep redis
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should be able to see that the redis module is installed&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Set Redis variables
&lt;/h2&gt;

&lt;p&gt;In the &lt;code&gt;.env&lt;/code&gt; file set or replace this values:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Driver configuration
CACHE_DRIVER=redis
QUEUE_CONNECTION=redis
SESSION_DRIVER=redis

# Redis setup
REDIS_HOST=localhost
REDIS_PASSWORD=null
REDIS_PORT=6379
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you are using &lt;strong&gt;Herd&lt;/strong&gt; everything would work, if you are using &lt;strong&gt;Herd Pro&lt;/strong&gt; there is a &lt;strong&gt;services&lt;/strong&gt; section, &lt;strong&gt;ONLY&lt;/strong&gt; if you are using that specific feature this variable should change &lt;code&gt;REDIS_PORT=6138&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Install Laravel Horizon
&lt;/h2&gt;

&lt;p&gt;In the terminal execute:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;composer require laravel/horizon
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And this other command to publish the files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php artisan horizon:install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 4: Check the connection
&lt;/h2&gt;

&lt;p&gt;In the terminal execute:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;You should be able to see the horizon response:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Horizon started successfully.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Step 5: Check Horizon Dashboard
&lt;/h2&gt;

&lt;p&gt;Go to the browser and add to your project url &lt;code&gt;your-project.test/horizon&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then you should be able to see the Horizon dashboard with status: active&lt;/p&gt;

&lt;p&gt;Now, you are able to run jobs and monitor them in horizon.&lt;/p&gt;

&lt;h1&gt;
  
  
  Bonus
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Step 6: Set Queues for different Jobs:
&lt;/h2&gt;

&lt;p&gt;You can go to &lt;code&gt;config/horizon.php&lt;/code&gt; and set specific queues and even add more supervisors, by default it checks only "defaul" queue, but as it is an array you can add multiple of them:&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;'defaults'&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;'supervisor-1'&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;'connection'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'redis'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'queue'&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;'default'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'sendEmailInvites'&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 only need to set a specific queue for your emails with something like this:&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;Mail&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;to&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'user@example.com'&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;queue&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;InvitationEmail&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="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;onQueue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'sendEmailInvites'&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 even go further and set Queue Configuration (not necessary)&lt;/p&gt;

&lt;p&gt;Make sure your config/queue.php has the queue configured:&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;'connections'&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;'redis'&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;'redis'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="c1"&gt;// ... other config&lt;/span&gt;
        &lt;span class="s1"&gt;'queue'&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;'REDIS_QUEUE'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'default'&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="c1"&gt;// You can also define named queues&lt;/span&gt;
&lt;span class="s1"&gt;'sendEmailInvites'&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;'redis'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'queue'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'sendEmailInvites'&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;



</description>
      <category>php</category>
      <category>laravel</category>
      <category>redis</category>
    </item>
    <item>
      <title>Create and Register a new SSH on Github</title>
      <dc:creator>Ariel Mejia</dc:creator>
      <pubDate>Wed, 28 Aug 2024 22:46:24 +0000</pubDate>
      <link>https://dev.to/arielmejiadev/create-and-register-a-new-ssh-on-github-3gf2</link>
      <guid>https://dev.to/arielmejiadev/create-and-register-a-new-ssh-on-github-3gf2</guid>
      <description>&lt;p&gt;It only requires three steps&lt;/p&gt;

&lt;h2&gt;
  
  
  1 Create a new SSH key
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh-keygen -o -t rsa -C "email@example.com"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2 Copy the content
&lt;/h2&gt;

&lt;p&gt;Just check the output of the first command, it would add a path of the ssh key &lt;code&gt;.pub&lt;/code&gt; file, now just copy the content:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pbcopy &amp;lt; /Users/&amp;lt;your-user-name&amp;gt;/.ssh/id_rsa.pub
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3 Register a new ssh key in GitHub
&lt;/h2&gt;

&lt;p&gt;You can add the content of the key in the form of this URL&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/settings/ssh/new" rel="noopener noreferrer"&gt;https://github.com/settings/ssh/new&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;it is done... happy coding!&lt;/p&gt;

</description>
      <category>github</category>
      <category>git</category>
    </item>
    <item>
      <title>Set an awesome terminal in MacOS</title>
      <dc:creator>Ariel Mejia</dc:creator>
      <pubDate>Wed, 28 Aug 2024 21:44:37 +0000</pubDate>
      <link>https://dev.to/arielmejiadev/set-an-awesome-terminal-in-macos-14g6</link>
      <guid>https://dev.to/arielmejiadev/set-an-awesome-terminal-in-macos-14g6</guid>
      <description>&lt;p&gt;Here a few tips that would bring your terminal experience to a whole new level.&lt;/p&gt;




&lt;h2&gt;
  
  
  Install Homebrew
&lt;/h2&gt;

&lt;p&gt;You can install homebrew &lt;a href="https://brew.sh/" rel="noopener noreferrer"&gt;Here&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Install Iterm
&lt;/h2&gt;

&lt;p&gt;It allows to work on a pretty custom terminal&lt;/p&gt;

&lt;p&gt;You can install Iterm 2 &lt;a href="https://iterm2.com/" rel="noopener noreferrer"&gt;Here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Personally I like to change iterm colors, it is placed in: &lt;code&gt;preference &amp;gt; profiles &amp;gt; colors tab &amp;gt; colors preset&lt;/code&gt;,  then just choose the preset you like.&lt;/p&gt;

&lt;h3&gt;
  
  
  Optionally you can add a custom theme for Iterm
&lt;/h3&gt;

&lt;p&gt;You can find iterm themes &lt;a href="https://iterm2colorschemes.com/" rel="noopener noreferrer"&gt;Here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Take in mind to add a theme you need to create an &lt;code&gt;.itermcolors&lt;/code&gt; file&lt;/p&gt;

&lt;p&gt;For example I like &lt;a href="https://raw.githubusercontent.com/mbadolato/iTerm2-Color-Schemes/master/schemes/Dracula.itermcolors" rel="noopener noreferrer"&gt;Dracula Theme&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So in order to add it I need to grab the content and create file like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd $HOME
vi .Dracula.itermcolors
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then insert the content of the selected theme in my case for dracula&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;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&amp;gt;
&amp;lt;plist version="1.0"&amp;gt;
&amp;lt;dict&amp;gt;
    &amp;lt;key&amp;gt;Ansi 0 Color&amp;lt;/key&amp;gt;
    &amp;lt;dict&amp;gt;
        &amp;lt;key&amp;gt;Blue Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.0&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Green Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.0&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Red Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.0&amp;lt;/real&amp;gt;
    &amp;lt;/dict&amp;gt;
    &amp;lt;key&amp;gt;Ansi 1 Color&amp;lt;/key&amp;gt;
    &amp;lt;dict&amp;gt;
        &amp;lt;key&amp;gt;Blue Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.3333333432674408&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Green Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.3333333432674408&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Red Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;1&amp;lt;/real&amp;gt;
    &amp;lt;/dict&amp;gt;
    &amp;lt;key&amp;gt;Ansi 10 Color&amp;lt;/key&amp;gt;
    &amp;lt;dict&amp;gt;
        &amp;lt;key&amp;gt;Blue Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.4823529411764706&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Green Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.98039215686274506&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Red Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.31372549019607843&amp;lt;/real&amp;gt;
    &amp;lt;/dict&amp;gt;
    &amp;lt;key&amp;gt;Ansi 11 Color&amp;lt;/key&amp;gt;
    &amp;lt;dict&amp;gt;
        &amp;lt;key&amp;gt;Blue Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.5490196078431373&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Green Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.98039215686274506&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Red Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.94509803921568625&amp;lt;/real&amp;gt;
    &amp;lt;/dict&amp;gt;
    &amp;lt;key&amp;gt;Ansi 12 Color&amp;lt;/key&amp;gt;
    &amp;lt;dict&amp;gt;
        &amp;lt;key&amp;gt;Blue Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.97647058823529409&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Green Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.57647058823529407&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Red Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.74117647058823533&amp;lt;/real&amp;gt;
    &amp;lt;/dict&amp;gt;
    &amp;lt;key&amp;gt;Ansi 13 Color&amp;lt;/key&amp;gt;
    &amp;lt;dict&amp;gt;
        &amp;lt;key&amp;gt;Blue Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.77647058823529413&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Green Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.47450980392156861&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Red Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;1&amp;lt;/real&amp;gt;
    &amp;lt;/dict&amp;gt;
    &amp;lt;key&amp;gt;Ansi 14 Color&amp;lt;/key&amp;gt;
    &amp;lt;dict&amp;gt;
        &amp;lt;key&amp;gt;Blue Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.99215686274509807&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Green Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.9137254901960784&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Red Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.54509803921568623&amp;lt;/real&amp;gt;
    &amp;lt;/dict&amp;gt;
    &amp;lt;key&amp;gt;Ansi 15 Color&amp;lt;/key&amp;gt;
    &amp;lt;dict&amp;gt;
        &amp;lt;key&amp;gt;Blue Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;1&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Green Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;1&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Red Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;1&amp;lt;/real&amp;gt;
    &amp;lt;/dict&amp;gt;
    &amp;lt;key&amp;gt;Ansi 2 Color&amp;lt;/key&amp;gt;
    &amp;lt;dict&amp;gt;
        &amp;lt;key&amp;gt;Blue Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.4823529411764706&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Green Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.98039215686274506&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Red Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.31372549019607843&amp;lt;/real&amp;gt;
    &amp;lt;/dict&amp;gt;
    &amp;lt;key&amp;gt;Ansi 3 Color&amp;lt;/key&amp;gt;
    &amp;lt;dict&amp;gt;
        &amp;lt;key&amp;gt;Blue Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.5490196078431373&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Green Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.98039215686274506&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Red Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.94509803921568625&amp;lt;/real&amp;gt;
    &amp;lt;/dict&amp;gt;
    &amp;lt;key&amp;gt;Ansi 4 Color&amp;lt;/key&amp;gt;
    &amp;lt;dict&amp;gt;
        &amp;lt;key&amp;gt;Blue Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.97647058823529409&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Green Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.57647058823529407&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Red Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.74117647058823533&amp;lt;/real&amp;gt;
    &amp;lt;/dict&amp;gt;
    &amp;lt;key&amp;gt;Ansi 5 Color&amp;lt;/key&amp;gt;
    &amp;lt;dict&amp;gt;
        &amp;lt;key&amp;gt;Blue Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.77647058823529413&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Green Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.47450980392156861&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Red Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;1&amp;lt;/real&amp;gt;
    &amp;lt;/dict&amp;gt;
    &amp;lt;key&amp;gt;Ansi 6 Color&amp;lt;/key&amp;gt;
    &amp;lt;dict&amp;gt;
        &amp;lt;key&amp;gt;Blue Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.99215686274509807&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Green Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.9137254901960784&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Red Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.54509803921568623&amp;lt;/real&amp;gt;
    &amp;lt;/dict&amp;gt;
    &amp;lt;key&amp;gt;Ansi 7 Color&amp;lt;/key&amp;gt;
    &amp;lt;dict&amp;gt;
        &amp;lt;key&amp;gt;Blue Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.73333334922790527&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Green Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.73333334922790527&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Red Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.73333334922790527&amp;lt;/real&amp;gt;
    &amp;lt;/dict&amp;gt;
    &amp;lt;key&amp;gt;Ansi 8 Color&amp;lt;/key&amp;gt;
    &amp;lt;dict&amp;gt;
        &amp;lt;key&amp;gt;Blue Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.33333333333333331&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Green Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.33333333333333331&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Red Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.33333333333333331&amp;lt;/real&amp;gt;
    &amp;lt;/dict&amp;gt;
    &amp;lt;key&amp;gt;Ansi 9 Color&amp;lt;/key&amp;gt;
    &amp;lt;dict&amp;gt;
        &amp;lt;key&amp;gt;Blue Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.33333333333333331&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Green Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.33333333333333331&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Red Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;1&amp;lt;/real&amp;gt;
    &amp;lt;/dict&amp;gt;
    &amp;lt;key&amp;gt;Background Color&amp;lt;/key&amp;gt;
    &amp;lt;dict&amp;gt;
        &amp;lt;key&amp;gt;Blue Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.15977837145328522&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Green Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.12215272337198257&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Red Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.11765811592340469&amp;lt;/real&amp;gt;
    &amp;lt;/dict&amp;gt;
    &amp;lt;key&amp;gt;Bold Color&amp;lt;/key&amp;gt;
    &amp;lt;dict&amp;gt;
        &amp;lt;key&amp;gt;Blue Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;1&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Green Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;1&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Red Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;1&amp;lt;/real&amp;gt;
    &amp;lt;/dict&amp;gt;
    &amp;lt;key&amp;gt;Cursor Color&amp;lt;/key&amp;gt;
    &amp;lt;dict&amp;gt;
        &amp;lt;key&amp;gt;Blue Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.73333334922790527&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Green Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.73333334922790527&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Red Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.73333334922790527&amp;lt;/real&amp;gt;
    &amp;lt;/dict&amp;gt;
    &amp;lt;key&amp;gt;Cursor Text Color&amp;lt;/key&amp;gt;
    &amp;lt;dict&amp;gt;
        &amp;lt;key&amp;gt;Blue Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;1&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Green Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;1&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Red Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;1&amp;lt;/real&amp;gt;
    &amp;lt;/dict&amp;gt;
    &amp;lt;key&amp;gt;Foreground Color&amp;lt;/key&amp;gt;
    &amp;lt;dict&amp;gt;
        &amp;lt;key&amp;gt;Blue Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.94901961088180542&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Green Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.97254902124404907&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Red Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.97254902124404907&amp;lt;/real&amp;gt;
    &amp;lt;/dict&amp;gt;
    &amp;lt;key&amp;gt;Selected Text Color&amp;lt;/key&amp;gt;
    &amp;lt;dict&amp;gt;
        &amp;lt;key&amp;gt;Blue Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;1&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Green Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;1&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Red Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;1&amp;lt;/real&amp;gt;
    &amp;lt;/dict&amp;gt;
    &amp;lt;key&amp;gt;Selection Color&amp;lt;/key&amp;gt;
    &amp;lt;dict&amp;gt;
        &amp;lt;key&amp;gt;Blue Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.35294118523597717&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Green Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.27843138575553894&amp;lt;/real&amp;gt;
        &amp;lt;key&amp;gt;Red Component&amp;lt;/key&amp;gt;
        &amp;lt;real&amp;gt;0.26666668057441711&amp;lt;/real&amp;gt;
    &amp;lt;/dict&amp;gt;
&amp;lt;/dict&amp;gt;
&amp;lt;/plist&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And save&lt;/p&gt;

&lt;p&gt;Then Go to Settings &amp;gt; Profiles &amp;gt; Colors &amp;gt; Colors Presets &amp;gt; Import &amp;gt; Users Home Directory &lt;/p&gt;

&lt;p&gt;Then press the three keys at the same time &lt;code&gt;command+shift+.&lt;/code&gt; to show hidden files and select the color theme created. &lt;/p&gt;

&lt;h2&gt;
  
  
  Install Oh My Zsh
&lt;/h2&gt;

&lt;p&gt;It allows to add more abilities to your terminal&lt;/p&gt;

&lt;p&gt;You can install it &lt;a href="https://ohmyz.sh/" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Install Power Level 10 theme
&lt;/h2&gt;

&lt;p&gt;It adds a lot of customizations options handled with an installation wizard:&lt;/p&gt;

&lt;p&gt;Clone manually&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' &amp;gt;&amp;gt;~/.zshrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Install using oh my zshell&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;git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then edit the oh my zsh rc file:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Using vi&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;vi ~/.zshrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Using nano&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;nano ~/.zshrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Search for the &lt;code&gt;ZSH_THEME&lt;/code&gt; key and update the value:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Restart ZSH&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;exec zsh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It would run the installation wizard automatically.&lt;/p&gt;

&lt;p&gt;To run again in the future the wizard execute &lt;code&gt;p10k configure&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Install autosuggestions
&lt;/h2&gt;

&lt;p&gt;Now you are able to install autosuggestions with "Oh My ZSH" &lt;a href="https://github.com/zsh-users/zsh-autosuggestions/blob/master/INSTALL.md#oh-my-zsh" rel="noopener noreferrer"&gt;the installation guide here&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Install Bat
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;cat&lt;/code&gt; is a command to show a file content, &lt;code&gt;bat&lt;/code&gt; does pretty much the same, but adding highlight syntax in the terminal output:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Install it using Hombrew&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;brew install bat
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Install it using MacPorts&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;port install bat
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Set Syntax Highlight Theme
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Generate a config file&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;bat --generate-config-file
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output 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;Success! Config file written to /Users/&amp;lt;username&amp;gt;/.config/bat/config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Grab the output and edit the file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;vi /Users/&amp;lt;username&amp;gt;/.config/bat/config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case, I update the theme to "Dracula", but there are some pretty popular themes like "Nord" or "Monokai"&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;






&lt;h2&gt;
  
  
  Set Vim syntax
&lt;/h2&gt;

&lt;p&gt;open &lt;code&gt;vim .vimrc&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And set this values (you can go as far as you need, this is just a simple example)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;set showmode
set autoindent
set tabstop=4
set expandtab
syntax on
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Set same terminal font for VSCode
&lt;/h2&gt;

&lt;p&gt;Open VSCode and press &lt;code&gt;CMD + ,&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then would open the palette and type &lt;code&gt;settings.json&lt;/code&gt; then add the font family and size that you want, in this case I would use the same Font Family from iterm using powerlevel10 theme:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"terminal.integrated.fontFamily": "Meslo LG M for Powerline"
"terminal.integrated.fontSize": 14
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are a lot of changes so it requires restarting your computer&lt;/p&gt;




&lt;p&gt;There is room to improve your terminal even more, in my case this configuration is fine, but there are other pretty common tools like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;fzf&lt;/li&gt;
&lt;li&gt;exa&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

</description>
      <category>macos</category>
      <category>terminal</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Remove all git local branches except "main"</title>
      <dc:creator>Ariel Mejia</dc:creator>
      <pubDate>Sat, 24 Aug 2024 08:17:03 +0000</pubDate>
      <link>https://dev.to/arielmejiadev/remove-all-git-local-branches-except-main-mlo</link>
      <guid>https://dev.to/arielmejiadev/remove-all-git-local-branches-except-main-mlo</guid>
      <description>&lt;p&gt;Working locally would tempt to acummulate a lot of git branches locally, most of the time we want to keep only the "main" branch, to execute this just run:&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="n"&gt;git&lt;/span&gt; &lt;span class="n"&gt;branch&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;grep&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="s2"&gt;"main"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;xargs&lt;/span&gt; &lt;span class="n"&gt;git&lt;/span&gt; &lt;span class="n"&gt;branch&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;D&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Explanation
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The first section &lt;code&gt;git branch&lt;/code&gt; list all the branches locally.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;grep -v "main"&lt;/code&gt; filter out from the output branches list the main branch&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;xargs git branch -D&lt;/code&gt; runs &lt;code&gt;git branch -D&lt;/code&gt; to all the branch items inside the branch list&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Happy Coding!&lt;/p&gt;

</description>
      <category>git</category>
      <category>github</category>
    </item>
    <item>
      <title>Test Your DOM in Laravel with PHPUnit</title>
      <dc:creator>Ariel Mejia</dc:creator>
      <pubDate>Sun, 21 Jul 2024 18:49:10 +0000</pubDate>
      <link>https://dev.to/arielmejiadev/test-your-dom-in-laravel-with-phpunit-2k00</link>
      <guid>https://dev.to/arielmejiadev/test-your-dom-in-laravel-with-phpunit-2k00</guid>
      <description>&lt;p&gt;PHPUnit comes out of the box with features like &lt;code&gt;AssertSee&lt;/code&gt; and &lt;code&gt;AssertSeeText&lt;/code&gt; in both cases we can assert against a specific text, to assert HTML tags we are going to rely on these features with some custom work to polish these a little bit more.&lt;/p&gt;

&lt;h2&gt;
  
  
  Case of use
&lt;/h2&gt;

&lt;p&gt;I need to test that some forms generate a CSRF token.&lt;/p&gt;

&lt;h2&gt;
  
  
  Basic Solution
&lt;/h2&gt;

&lt;p&gt;Laravel CSRF token directive generates an input like this:&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="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"hidden"&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"_token"&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"random_generated_token"&lt;/span&gt; &lt;span class="err"&gt;...&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As the generated token changes between requests we are not going to test the generated token value, instead we are going to assert that the input exists with some of the attributes required, PHPUnit &lt;code&gt;assertSee&lt;/code&gt; has second param to escape a value so we can do something like this:&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;$this&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;span class="s2"&gt;"contact-us"&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;assertSee&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
        &lt;span class="s1"&gt;'&amp;lt;input name="some_database_column"'&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Improving iteration
&lt;/h2&gt;

&lt;p&gt;It would solve our solution, but probably there is a better way to use this for more cases, so writing using a "wishful thinking" approach my desired code would be something like this:&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;$this&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;span class="s2"&gt;"contact-us"&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;assertHtml&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'input'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s2"&gt;"type"&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"hidden"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"name"&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"_token"&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 would be useful as it adds an assertion that would work in multiple cases by only passing the tag name and an array of attributes&lt;/p&gt;

&lt;p&gt;We can add something like this in Laravel by adding a custom &lt;code&gt;macro&lt;/code&gt; to the &lt;code&gt;TestResponse&lt;/code&gt; class in the &lt;code&gt;AppServiceProvider&lt;/code&gt; or any other custom Provider:&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;TestResponse&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;macro&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'assertHtml'&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="nv"&gt;$tag&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$attributes&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$attributes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;collect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$attributes&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;map&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="nv"&gt;$attributeValue&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$attributeKey&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="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$attributeKey&lt;/span&gt;&lt;span class="s2"&gt;=&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="nv"&gt;$attributeValue&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt; "&lt;/span&gt;&lt;span class="p"&gt;;&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;values&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;implode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="nv"&gt;$htmlElement&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;$tag&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$attributes&lt;/span&gt;&lt;span class="s2"&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="nf"&gt;assertSee&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="nv"&gt;$htmlElement&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="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we can test our DOM by testing the presence of a tag and an attribute.&lt;/p&gt;

&lt;h2&gt;
  
  
  Aiming Laravelish Way
&lt;/h2&gt;

&lt;p&gt;We can go a little bit forward in this case, I would need to assert that a form as CSRF tokens in multiple forms in the app, so we can rely on our macro to create more assertions, in this case as the expected HTML tag and attributes would not change I can add something like this:&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;TestResponse&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;macro&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'assertCSRFTokenExists'&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="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;assertHtml&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'input'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s2"&gt;"type"&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"hidden"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"name"&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"_token"&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 assertion is short, reusable, easy to read and 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="nv"&gt;$this&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;span class="s2"&gt;"contact-us"&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;assertCSRFTokenExists&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For more powerful assertions you should consider an excellent package like:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/sinnbeck/laravel-dom-assertions" rel="noopener noreferrer"&gt;sinnbeck/laravel-dom-assertions&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hopefully, this helps to add basic DOM assertions in your tests&lt;/p&gt;

</description>
      <category>php</category>
      <category>laravel</category>
      <category>phpunit</category>
      <category>testing</category>
    </item>
    <item>
      <title>Customize Filament Table Query</title>
      <dc:creator>Ariel Mejia</dc:creator>
      <pubDate>Sun, 30 Jun 2024 18:32:44 +0000</pubDate>
      <link>https://dev.to/arielmejiadev/customize-filament-table-query-2c2c</link>
      <guid>https://dev.to/arielmejiadev/customize-filament-table-query-2c2c</guid>
      <description>&lt;p&gt;I am going to share how you can customize the query applying filters, this tip has a meilisearch example borrowed as I found the tip in a laracast chat, the content was enriched by me.&lt;/p&gt;

&lt;p&gt;To customize the table search to use some Laravel Scout Driver to get a fuzzyness search or a more powerful search in terms of speed:&lt;/p&gt;

&lt;h2&gt;
  
  
  The Inline Way
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="c1"&gt;// filter criteria&lt;/span&gt;
&lt;span class="nv"&gt;$filter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'(status = Active) AND (type = big)'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// $this-&amp;gt;query is a prop provided by extending from filament resource class&lt;/span&gt;
&lt;span class="nv"&gt;$company_ids&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;\App\Models\Company&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;search&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;query&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="nc"&gt;\Meilisearch\Endpoints\Indexes&lt;/span&gt; &lt;span class="nv"&gt;$meilisearch&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$query&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$options&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$filter&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// This is a custom configuration for Meilisearch only&lt;/span&gt;
    &lt;span class="nv"&gt;$options&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'facets'&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;span class="s1"&gt;'type'&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="nv"&gt;$options&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'filter'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$filter&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nv"&gt;$options&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'hitsPerPage'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&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;$meilisearch&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$query&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$options&lt;/span&gt;&lt;span class="p"&gt;);&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;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;pluck&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'id'&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;$table&lt;/span&gt;
    &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;\App\Models\Company&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;whereIn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'id'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$company_ids&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;columns&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
        &lt;span class="nc"&gt;TextColumn&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;make&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="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;sortable&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
        &lt;span class="nc"&gt;TextColumn&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;make&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="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;sortable&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
        &lt;span class="nc"&gt;TextColumn&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;make&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'type'&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;sortable&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;h2&gt;
  
  
  The Override Way
&lt;/h2&gt;

&lt;p&gt;We can also override the &lt;code&gt;getEloquentQuery&lt;/code&gt; method, like this example removing a global scope for soft deletes:&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;static&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;getEloquentQuery&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="kt"&gt;Builder&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;parent&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;getEloquentQuery&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;withoutGlobalScopes&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="nc"&gt;SoftDeleted&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="o"&gt;-&amp;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;'products'&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;



</description>
      <category>php</category>
      <category>laravel</category>
      <category>filamentphp</category>
      <category>tailwindcss</category>
    </item>
    <item>
      <title>Change Default Colors in FilamentPHP</title>
      <dc:creator>Ariel Mejia</dc:creator>
      <pubDate>Sun, 30 Jun 2024 18:18:10 +0000</pubDate>
      <link>https://dev.to/arielmejiadev/change-default-colors-in-filamentphp-10p2</link>
      <guid>https://dev.to/arielmejiadev/change-default-colors-in-filamentphp-10p2</guid>
      <description>&lt;h2&gt;
  
  
  Set Colors for a single Resources
&lt;/h2&gt;

&lt;p&gt;Using filament we are able to define the colors for all the resources in the &lt;code&gt;AppPanelProvider.php&lt;/code&gt; class, this class is typically the one that is created by default in a filament project installation command, we can define a lot of features in this case we are going to set the colors for the whole resources:&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;panel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;Panel&lt;/span&gt; &lt;span class="nv"&gt;$panel&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kt"&gt;Panel&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;$panel&lt;/span&gt;
        &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="k"&gt;default&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;id&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'app'&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;path&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="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;login&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;colors&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
            &lt;span class="s1"&gt;'primary'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nc"&gt;Slate&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'gray'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nc"&gt;Gray&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 all the genereated resources are going to use this colors, take in mind that the value of the colors is handle by a Color class provided by Filament in the namespace &lt;code&gt;namespace Filament\Support\Colors&lt;/code&gt; and it provides an identifier for all the colors in the TailwindCSS color pallete.&lt;/p&gt;

&lt;h2&gt;
  
  
  Set colors in a custom action
&lt;/h2&gt;

&lt;p&gt;You can define custom actions using &lt;code&gt;vainilla&lt;/code&gt; livewire components, in this cases you would need to explicitly define the color by chaining the &lt;code&gt;colors&lt;/code&gt; method:&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="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nc"&gt;Slate&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Set Colors Globally
&lt;/h2&gt;

&lt;p&gt;From a service provider's &lt;code&gt;boot()&lt;/code&gt; method you can define the colors for your app globally:&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;boot&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;FilamentColor&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;register&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
        &lt;span class="s1"&gt;'danger'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nc"&gt;Red&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'gray'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nc"&gt;Zinc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'info'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nc"&gt;Blue&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'primary'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nc"&gt;Indigo&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'success'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nc"&gt;Green&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'warning'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Color&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nc"&gt;Amber&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;In this example this script replace the &lt;code&gt;Amber&lt;/code&gt; color as the primary color for the &lt;code&gt;Indigo&lt;/code&gt; all of the Tailwind Colors Pallette is available in the &lt;code&gt;Colors&lt;/code&gt; class provided by Filament.&lt;/p&gt;

&lt;p&gt;You can add more color options and even customize them from hex color codes to customize it even more you can follow the docs for this section &lt;a href="https://filamentphp.com/docs/3.x/support/colors#registering-extra-colors"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

</description>
      <category>php</category>
      <category>laravel</category>
      <category>filament</category>
      <category>tailwindcss</category>
    </item>
    <item>
      <title>Debug Filament Search Query</title>
      <dc:creator>Ariel Mejia</dc:creator>
      <pubDate>Thu, 20 Jun 2024 06:18:20 +0000</pubDate>
      <link>https://dev.to/arielmejiadev/debug-filament-search-query-1aed</link>
      <guid>https://dev.to/arielmejiadev/debug-filament-search-query-1aed</guid>
      <description>&lt;p&gt;Filament Resources allow to create quickly tables by mapping objects, it allows to add easily pretty common features like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;sortable&lt;/li&gt;
&lt;li&gt;searchable&lt;/li&gt;
&lt;li&gt;and more features&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;in this case to debug the search query we can check the List class that is created by default when a user creates a filament resource, eg: &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;User Resource&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;UserResource&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Resource&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;?string&lt;/span&gt; &lt;span class="nv"&gt;$model&lt;/span&gt; &lt;span class="o"&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="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;getPages&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;'index'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;ListUsers&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;route&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="c1"&gt;// ... more pages&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;ListUsers&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here we can override a &lt;code&gt;getFilteredTableQuery&lt;/code&gt; method to check the raw sql and debug the query&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="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;getFilteredTableQuery&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="kt"&gt;Builder&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;dd&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;parent&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;getFilteredTableQuery&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;toRawSql&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;Hope it is useful &amp;amp; Happy Coding!&lt;/p&gt;

</description>
      <category>php</category>
      <category>laravel</category>
      <category>filament</category>
    </item>
    <item>
      <title>Open Successfully iOS Simulator with React Native &amp; Expo</title>
      <dc:creator>Ariel Mejia</dc:creator>
      <pubDate>Wed, 19 Jun 2024 01:01:11 +0000</pubDate>
      <link>https://dev.to/arielmejiadev/open-successfully-ios-simulator-with-react-native-expo-472b</link>
      <guid>https://dev.to/arielmejiadev/open-successfully-ios-simulator-with-react-native-expo-472b</guid>
      <description>&lt;p&gt;There are some downsides in the process to run IOS Simulator using Expo, here is a little guide to fix these issues:&lt;/p&gt;

&lt;h2&gt;
  
  
  Install X Code
&lt;/h2&gt;

&lt;p&gt;Here a link to install&lt;br&gt;
&lt;a rel="noopener noreferrer" href="https://apps.apple.com/us/app/xcode/id497799835"&gt;Xcode&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Install Xcode Command Line Tools
&lt;/h2&gt;

&lt;p&gt;This is a tricky section as at the first installation it looks like there is a &lt;code&gt;Command Line Tools&lt;/code&gt; already selected, but it is not, you can find it in &lt;code&gt;Xcode &amp;gt; Preferences &amp;gt; Locations&lt;/code&gt; so we need to click the option that appears to set the &lt;code&gt;Command Line Tools&lt;/code&gt; path&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffkwddf3h5pneh8a2bqq6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffkwddf3h5pneh8a2bqq6.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Install Watchman
&lt;/h2&gt;

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

brew update
brew install watchman


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Run Expo
&lt;/h2&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

npx expo start


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;and press &lt;code&gt;i&lt;/code&gt; to select &lt;code&gt;ios simulator&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Fixes
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The easiest solution is to restart the computer.&lt;/li&gt;
&lt;li&gt;The second solution is to delete &lt;code&gt;node_modules&lt;/code&gt; folder and &lt;code&gt;package-lock.json&lt;/code&gt;, then run npm install, then run &lt;code&gt;npx expo start&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  In Summary
&lt;/h2&gt;

&lt;p&gt;The sections where most issues to run iOS Simulator are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;User has not select &lt;code&gt;Command Line Tools&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Sometimes previous attempts to make it run can produce issues, to avoid this just delete &lt;code&gt;node_modules&lt;/code&gt; and re-run &lt;code&gt;npm install&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>reactnative</category>
      <category>expo</category>
    </item>
    <item>
      <title>Laravel get route name from given URL</title>
      <dc:creator>Ariel Mejia</dc:creator>
      <pubDate>Fri, 24 May 2024 14:38:48 +0000</pubDate>
      <link>https://dev.to/arielmejiadev/laravel-get-route-name-from-given-url-2dde</link>
      <guid>https://dev.to/arielmejiadev/laravel-get-route-name-from-given-url-2dde</guid>
      <description>&lt;p&gt;A common use case for a tabs component is to check if a routes as strings is the current route or if it exists in your app.&lt;/p&gt;

&lt;p&gt;Laravel Route facade allows to expose the route object easily to check this:&lt;/p&gt;

&lt;h6&gt;
  
  
  Using the route name
&lt;/h6&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$route&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'users.index'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nc"&gt;Route&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;getRoutes&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="k"&gt;match&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$route&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h6&gt;
  
  
  Using a string
&lt;/h6&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'https://your-app.com/users'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nc"&gt;Request&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;$url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hope that the tip is useful!&lt;/p&gt;

</description>
      <category>php</category>
      <category>laravel</category>
    </item>
    <item>
      <title>Customize Reset Password Mail in Laravel</title>
      <dc:creator>Ariel Mejia</dc:creator>
      <pubDate>Wed, 13 Mar 2024 23:08:49 +0000</pubDate>
      <link>https://dev.to/arielmejiadev/customize-forgot-password-mail-in-laravel-5cjm</link>
      <guid>https://dev.to/arielmejiadev/customize-forgot-password-mail-in-laravel-5cjm</guid>
      <description>&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;Laravel provides by default a forgot password feature for &lt;code&gt;User&lt;/code&gt; model, you can find it in &lt;code&gt;authorizable&lt;/code&gt; alias that extends to &lt;code&gt;User&lt;/code&gt; 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;User&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Model&lt;/span&gt; &lt;span class="kd"&gt;implements&lt;/span&gt;
    &lt;span class="nc"&gt;AuthenticatableContract&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nc"&gt;AuthorizableContract&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nc"&gt;CanResetPasswordContract&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Authenticatable&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Authorizable&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;CanResetPassword&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;MustVerifyEmail&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;code&gt;User&lt;/code&gt; model has a method that send the notification to reset password:&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;sendPasswordResetNotification&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$token&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can override it to handle or custom messages.&lt;/p&gt;

&lt;h2&gt;
  
  
  Customizing Reset Password notification
&lt;/h2&gt;

&lt;p&gt;First, we are going to create or own notification that would extend from the default &lt;code&gt;ResetPassword&lt;/code&gt; notification from Laravel:&lt;/p&gt;

&lt;p&gt;In terminal create a new notification:&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="n"&gt;php&lt;/span&gt; &lt;span class="n"&gt;artisan&lt;/span&gt; &lt;span class="n"&gt;make&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="n"&gt;notification&lt;/span&gt; &lt;span class="nc"&gt;ResetPassword&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then we are going to override &lt;code&gt;sendPasswordResetNotification&lt;/code&gt; method in &lt;code&gt;User&lt;/code&gt; 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="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;App\Notifications\ResetPassword&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&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;sendPasswordResetNotification&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$token&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="nf"&gt;notify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ResetPassword&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$token&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;Just make sure that you import our custom notification.&lt;/p&gt;

&lt;h2&gt;
  
  
  Customize notification
&lt;/h2&gt;

&lt;p&gt;In this example for the sake of simplicity I am going to extend from the default &lt;code&gt;resetPassword&lt;/code&gt; from Laravel&lt;/p&gt;

&lt;p&gt;Eg: replace a subject message:&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="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;buildMailMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$url&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="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;MailMessage&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;subject&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Here a custom subject'&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;



</description>
      <category>php</category>
      <category>laravel</category>
    </item>
    <item>
      <title>Fix Memory Exhausted Issue in Laravel Tests</title>
      <dc:creator>Ariel Mejia</dc:creator>
      <pubDate>Wed, 28 Feb 2024 22:09:45 +0000</pubDate>
      <link>https://dev.to/arielmejiadev/fix-memory-exhausted-issue-in-laravel-tests-5dji</link>
      <guid>https://dev.to/arielmejiadev/fix-memory-exhausted-issue-in-laravel-tests-5dji</guid>
      <description>&lt;p&gt;Quick and easy tip, sometimes a test could take too much time/memory, you can set your local environment &lt;code&gt;memory_limit&lt;/code&gt;, but take in mind that you should repeat this process on every environment (local, staging, production) and all development team environments should add this configuration, not best solution right? &lt;/p&gt;

&lt;p&gt;Fortunately. &lt;strong&gt;PHPUnit&lt;/strong&gt; provides a simple solution for this cases you can set a &lt;code&gt;memory_limit&lt;/code&gt; value that would instruct the memory limit only when the app runs tests.&lt;/p&gt;

&lt;p&gt;In your &lt;code&gt;phpunit.xml&lt;/code&gt; file add this configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;php&amp;gt;&lt;/span&gt;
 ...
 &lt;span class="nt"&gt;&amp;lt;ini&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"memory_limit"&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"512M"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/php&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>php</category>
      <category>laravel</category>
      <category>phpunit</category>
      <category>pest</category>
    </item>
  </channel>
</rss>
