<?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: Buddhi Eashwarage</title>
    <description>The latest articles on DEV Community by Buddhi Eashwarage (@buddhieash).</description>
    <link>https://dev.to/buddhieash</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%2F972032%2Fcd0f2039-0077-45d6-905a-6de495ec895b.png</url>
      <title>DEV Community: Buddhi Eashwarage</title>
      <link>https://dev.to/buddhieash</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/buddhieash"/>
    <language>en</language>
    <item>
      <title>Laravel Unit Test Exceptions</title>
      <dc:creator>Buddhi Eashwarage</dc:creator>
      <pubDate>Sat, 20 Jul 2024 04:53:41 +0000</pubDate>
      <link>https://dev.to/buddhieash/laravel-unit-test-exceptions-4dgc</link>
      <guid>https://dev.to/buddhieash/laravel-unit-test-exceptions-4dgc</guid>
      <description>&lt;p&gt;Let’s see how to unit test Exceptions in Laravel with PHPUnit. For that, I’m going to create a hypothetical scenario where there is a student class greets to new student, and it accepts 2 arguments. The first argument is a greeting such as “Hi”, “Hello”, and “Welcome”. And the second argument is the first name of the student such as “Tom”, “Andrew”, “Peter”, etc. So, we’re going to throw an exception here if the first argument for the greeting is not a desired one from our list.&lt;/p&gt;

&lt;p&gt;I'm going to create a new "Student" class using PHP artisan.&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%2Flvuvcxus6i0pq214l1ev.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%2Flvuvcxus6i0pq214l1ev.png" alt="create a new "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, it will appear in the VS Code as below.&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%2Fcc5x6riiqikzfs45gclj.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%2Fcc5x6riiqikzfs45gclj.png" alt="appear in the VS Code"&gt;&lt;/a&gt;&lt;br&gt;
Let's add the logic there.&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%2F4y6m78r1kvrj7g3f6fni.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%2F4y6m78r1kvrj7g3f6fni.png" alt="add the logic"&gt;&lt;/a&gt;&lt;br&gt;
In this logic, it accepts any greeting, but I need to restrict that only to several ones as mentioned earlier.&lt;/p&gt;

&lt;p&gt;So, what I'm going to do here is to filter from our desired list, and throw an exception if the greeting is not in our list. I'm using the opposite of the Core PHP function in_array().&lt;/p&gt;

&lt;p&gt;So the updated logic will be like this.&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%2Fonth3vbmaowt6890iy86.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%2Fonth3vbmaowt6890iy86.png" alt="the updated logic"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's try this from the tinker. If you like to test this from the browser, I have created a YouTube video for that. Please refer to that - &lt;a href="https://www.youtube.com/watch?v=8P69Imlq800" rel="noopener noreferrer"&gt;YouTube video&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In Laravel Tinker, we can simply test like below. And it's even thrown an exception as we expected!!&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%2Fd25k01tl1jnyws69n2ng.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%2Fd25k01tl1jnyws69n2ng.png" alt="Laravel Tinker, we can simply test"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let's try the most important part which is unit testing.&lt;/p&gt;

&lt;p&gt;I'm creating a new unit test from an artisan command.&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%2F53061e3gg6m7j5uino9k.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%2F53061e3gg6m7j5uino9k.png" alt="creating a new unit test"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, there is a fresh unit test created.&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%2Fxjyyti9afxao2v7fx1vj.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%2Fxjyyti9afxao2v7fx1vj.png" alt="a fresh unit test created"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's add the unit test for testing a successful operation first.&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%2F9f85enstazlu6a0vqved.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%2F9f85enstazlu6a0vqved.png" alt="test for testing a successful operation"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Cool, it's passing!!&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%2F2k9walycsqrhlz41vyql.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%2F2k9walycsqrhlz41vyql.png" alt="it's passing"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's add a test case for testing the exception.&lt;/p&gt;

&lt;p&gt;But there's a trick in that test case.&lt;/p&gt;

&lt;p&gt;We need to assert before calling the Student object's "greetStudent()" method.&lt;/p&gt;

&lt;p&gt;Why is that? Because once an exception is thrown the method exits. Therefore, we need to prepare the unit test beforehand.&lt;/p&gt;

&lt;p&gt;Let's see how it goes.&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%2Flmc0jm4rrdq8ytz0mo3j.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%2Flmc0jm4rrdq8ytz0mo3j.png" alt="Let's see how it goes"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The test case will be like the above.&lt;/p&gt;

&lt;p&gt;If we swap the lines, like below it will fail due to the reason that I mentioned a while ago.&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%2Fispdjx2mcdh36audgekk.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%2Fispdjx2mcdh36audgekk.png" alt="swap the lines"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, we need to carefully put the lines in the correct order.&lt;/p&gt;

&lt;p&gt;The output after running the test cases is:&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%2Fo8iq4qycatm9jluv9web.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%2Fo8iq4qycatm9jluv9web.png" alt="output after running the test cases"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It's passing! Which means it threw an exception successfully!&lt;/p&gt;

&lt;p&gt;Let's go ahead an another step. &lt;/p&gt;

&lt;p&gt;We can write a unit test for the exact Exception message.&lt;/p&gt;

&lt;p&gt;Let's try it out.&lt;/p&gt;

&lt;p&gt;It's like this.&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%2Frdr7pzh6c1a2cbay6ijd.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%2Frdr7pzh6c1a2cbay6ijd.png" alt="a unit test for the exact Exception message"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It's also passing!&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%2F9q7y4bjnq7vdxinr7698.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%2F9q7y4bjnq7vdxinr7698.png" alt="It's also passing"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's it!&lt;/p&gt;

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

</description>
      <category>webdev</category>
      <category>laravel</category>
      <category>php</category>
      <category>unittest</category>
    </item>
    <item>
      <title>Laravel Wildcard Routes &amp; Fallback Routes</title>
      <dc:creator>Buddhi Eashwarage</dc:creator>
      <pubDate>Mon, 15 Jul 2024 02:11:40 +0000</pubDate>
      <link>https://dev.to/buddhieash/laravel-wildcard-routes-fallback-routes-2k3a</link>
      <guid>https://dev.to/buddhieash/laravel-wildcard-routes-fallback-routes-2k3a</guid>
      <description>&lt;p&gt;Laravel routes can be categorized into several types. The wildcard routes and fallback routes are quite popular among them.&lt;/p&gt;

&lt;p&gt;So, let’s explore when to use them.&lt;/p&gt;

&lt;h3&gt;
  
  
  Spoiler Alert
&lt;/h3&gt;

&lt;p&gt;▶️ Please note that there's a YouTube version of this article as well.&lt;/p&gt;

&lt;p&gt;LINK - &lt;a href="https://www.youtube.com/watch?v=5n1MqSEE7vU" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=5n1MqSEE7vU&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Wildcard routes
&lt;/h2&gt;

&lt;p&gt;As the word “wildcard” emphasizes it can have any value. We don’t need to declare the routes explicitly here and Laravel resolves them for us implicitly. But when defining wildcard routes there is something we should keep in mind. That’s the order of the routes!&lt;/p&gt;

&lt;p&gt;This means when we define the wildcard routes with normal routes, first we should define the normal routes then the wildcard routes, and finally the fallback route (I’ll explain this in a second 🙂)&lt;/p&gt;

&lt;p&gt;The following route is the only visible route when you have a fresh Laravel installation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjm57q0ryc0bmbrl159gr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjm57q0ryc0bmbrl159gr.png" alt="fresh Laravel installation" width="800" height="192"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, let’s add some routes there. And then it’ll look like below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcvach2izj8msff52p9l2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcvach2izj8msff52p9l2.png" alt="add some routes there" width="800" height="361"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the correct order.&lt;/p&gt;

&lt;p&gt;As you can see I have highlight the wildcard route in red, and it goes inside curly braces.&lt;/p&gt;

&lt;p&gt;In local development environment if we try to access the route:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://127.0.0.1:8000/hello/world" rel="noopener noreferrer"&gt;http://127.0.0.1:8000/hello/world&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This will return “Hello World From Normal Route!!”&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0uzxndc4z33g3etpsrvz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0uzxndc4z33g3etpsrvz.png" alt="Hello World From Normal Route" width="800" height="361"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And if we hit the route &lt;a href="http://127.0.0.1:8000/hello/test" rel="noopener noreferrer"&gt;http://127.0.0.1:8000/hello/test&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg8uw6rn1j2k0lbpcbgsd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg8uw6rn1j2k0lbpcbgsd.png" alt="we hit the route" width="800" height="361"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can use any name for the second part instead of using “/test” such as “/banana”, “/burger”, “/bmw”, etc 😀&lt;/p&gt;

&lt;p&gt;This will return “Hello World From Wild Card Route!!”&lt;/p&gt;

&lt;p&gt;All good right?&lt;/p&gt;

&lt;p&gt;But what will happen if we swap the order of these routes as below?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9sooth8wvj4yhyys1zuv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9sooth8wvj4yhyys1zuv.png" alt="swap the order" width="800" height="370"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here the wildcard route is the first route and then the normal route. Can you guess the output?&lt;/p&gt;

&lt;p&gt;Both routes will return “Hello World From Wild Card Route!!”.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://127.0.0.1:8000/hello/world" rel="noopener noreferrer"&gt;http://127.0.0.1:8000/hello/world&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;&lt;a href="http://127.0.0.1:8000/hello/test" rel="noopener noreferrer"&gt;http://127.0.0.1:8000/hello/test&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxoymbhtr0px4qie9vjzn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxoymbhtr0px4qie9vjzn.png" alt="Hello test wildcard" width="800" height="361"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Why is that?&lt;/p&gt;

&lt;p&gt;Because “/hello” is a prefix for the route and it’s common for both wildcard and normal routes. So Laravel ignores all the routes after the “/hello” and resolves through “/{anyroute}” part. That’s why it’s important the routes defining order when you’re using wildcard routes.&lt;/p&gt;

&lt;p&gt;Let’s explore the fallback route now.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fallback route
&lt;/h2&gt;

&lt;p&gt;Laravel has a default 404 / Not Found page.&lt;/p&gt;

&lt;p&gt;Which means if I try to access and undefined route, it’ll show me a page like below.&lt;/p&gt;

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

&lt;p&gt;But using the Laravel fallback route option allows us to customize that behavior.&lt;/p&gt;

&lt;p&gt;Defining a fallback route is simple as below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmtxquhmy8s5h4pduhx9p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmtxquhmy8s5h4pduhx9p.png" alt="Defining a fallback route" width="800" height="706"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It will give us a custom 404 page as below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5mgodc8ozlm0tkqtegoo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5mgodc8ozlm0tkqtegoo.png" alt="custom 404 page" width="800" height="426"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But again please keep in mind the order of the routes matters here as well. Therefore the recommended way is to define the fallback route at the bottom of the routes list.&lt;/p&gt;

&lt;p&gt;Even you can point the fallback route to a controller method as well as you can do with the other routes which will help to add more customized logic inside the controller and return different views accordingly.&lt;/p&gt;

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

</description>
    </item>
    <item>
      <title>How to secure a WordPress website in under 1 minute using a simple trick?</title>
      <dc:creator>Buddhi Eashwarage</dc:creator>
      <pubDate>Thu, 28 Dec 2023 14:24:10 +0000</pubDate>
      <link>https://dev.to/buddhieash/how-to-secure-a-wordpress-website-in-under-1-minute-using-a-simple-trick-3jbb</link>
      <guid>https://dev.to/buddhieash/how-to-secure-a-wordpress-website-in-under-1-minute-using-a-simple-trick-3jbb</guid>
      <description>&lt;p&gt;&lt;a href="https://wordpress.org/" rel="noopener noreferrer"&gt;WordPress&lt;/a&gt; is the most popular CMS(Content Management System) among bloggers. The same fact has made WordPress more vulnerable to attacks by hackers. Especially for authentication vulnerabilities such as brute-force attacks.&lt;/p&gt;

&lt;p&gt;We can mitigate the risks of these types of attacks on WordPress websites by simply installing and configuring a plugin.&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%2Ffl4gqv76i5buaiv2crrd.jpeg" 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%2Ffl4gqv76i5buaiv2crrd.jpeg" alt="wp-admin-login-demo-image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As I mentioned before WordPress is the most popular CMS, and anyone knows the default admin login URL of a WordPress site which is equivalent to "{WORDPRESS_SITE_DOMAIN}/wp-admin". So the "wp-admin" suffix is the route that navigates the user to the admin login page. &lt;/p&gt;

&lt;p&gt;So our simple trick is to change that route to a custom one and not allow the hackers to guess it and perform a brute-force attack.&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%2Fjx4xbywemswqi29k0a4w.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%2Fjx4xbywemswqi29k0a4w.png" alt="Change WP Admin Login Plugin"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For this, we need to install a plugin called &lt;a href="https://wordpress.org/plugins/change-wp-admin-login/" rel="noopener noreferrer"&gt;Change WP Admin Login&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Once installed the plugin from plugins section in WordPress, it should appear as below.&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%2Ff7pggtnhhchlz9xyrh5l.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%2Ff7pggtnhhchlz9xyrh5l.png" alt="Change WP Admin Login Installed"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You're almost done, and it's just left 1 last step to complete.&lt;/p&gt;

&lt;p&gt;Now we just need to provide our desired custom route to replace the default "wp-admin" one. So navigate to Settings--&amp;gt;Permalinks and bottom of the page it will appear "Change wp-admin login" section.&lt;/p&gt;

&lt;p&gt;So just provide the custom name under "Login URL" input field. Additionally can add a value to "Redirect URL" input field as well. As an example if you have a default "404 not found" page with the website, you can add it. Or else simply keeping it empty will redirect the user to site's home page when someone tries to access "wp-admin" route.&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%2Fysbka31mkajl92angx9m.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%2Fysbka31mkajl92angx9m.png" alt="Reflected wp admin login changes"&gt;&lt;/a&gt;&lt;br&gt;
[I have used &lt;a href="https://shoppersprestige.com/" rel="noopener noreferrer"&gt;https://shoppersprestige.com/&lt;/a&gt; WordPress site for demonstrating the custom URL]&lt;/p&gt;

&lt;p&gt;That's it!! Now save changes, and just after that you can log out and see. You'll be on "{WORDPRESS_SITE_DOMAIN}/{CUSTOM_ADMIN_ROUTE}"&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>wordpress</category>
      <category>security</category>
      <category>programming</category>
    </item>
    <item>
      <title>Integrating Google reCAPTCHA V3 with Wordpress WPForms</title>
      <dc:creator>Buddhi Eashwarage</dc:creator>
      <pubDate>Thu, 21 Dec 2023 12:45:11 +0000</pubDate>
      <link>https://dev.to/buddhieash/integrating-google-recaptcha-v3-with-wordpress-wpforms-2pcf</link>
      <guid>https://dev.to/buddhieash/integrating-google-recaptcha-v3-with-wordpress-wpforms-2pcf</guid>
      <description>&lt;p&gt;&lt;a href="https://wordpress.org/"&gt;WordPress&lt;/a&gt; is one of the most popular CMS(Content Management System). Not only that but also it's a highly customizable platform. As an example if you want to get e-commerce features get it added top of your normal CMS features, you can integrate &lt;a href="https://woo.com/"&gt;Woocommerce&lt;/a&gt; through &lt;a href="https://wordpress.org/plugins/woocommerce/"&gt;Woocommerce&lt;/a&gt; plugin.&lt;/p&gt;

&lt;p&gt;Hope you got an idea how far Wordpress is a customizable platform. Wordpress plugins do the magic!! So we can simply integrate a drag and drop Wordpress form builder called &lt;a href="https://wpforms.com/"&gt;WPForms&lt;/a&gt;. In my case I wanted to integrate a "Contact us" form specifically to my Wordpress site, and &lt;a href="https://wordpress.org/plugins/wpforms-lite/"&gt;WPForms contact us form plugin&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Everything went well for several weeks. After that there was a sudden spike in "Contact us" form submissions, and realized that it's not normal. Some spammers and bots simulated actual user behaviors. So I wanted to get rid of it, and decided to go ahead with Google reCAPTCHA integration with the "Contact us" form. I wanted to integrate reCAPTCHA V3 specifically with the form since it gives a better user experience because V3 is based on a scoring unlike ticking a checkbox in V2.&lt;/p&gt;

&lt;p&gt;I'll demonstrate how to integrate this to your Wordpress site, and I'm using a site called &lt;a href="https://shoppersprestige.com/"&gt;Shoppers' Prestige&lt;/a&gt; who is one of my clients.&lt;/p&gt;

&lt;p&gt;First you need to go visit &lt;a href="https://www.google.com/recaptcha/about/"&gt;Google reCAPTCHA console&lt;/a&gt;. And you'll be on a page similar to this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_m4ooVZq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ypq73zrw2ci2k8rufy96.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_m4ooVZq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ypq73zrw2ci2k8rufy96.png" alt="Google reCAPTCHA console" width="800" height="424"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on "v3 Admin Console" link.&lt;/p&gt;

&lt;p&gt;Then you'll be on a page like this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lscn6yrP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bqbaymugs3ndz2cxa06t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lscn6yrP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bqbaymugs3ndz2cxa06t.png" alt="v3 Admin Console" width="800" height="597"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Simply fill the details such as "Label" to give a meaningful name, and the domain that you're going to use Google reCAPTCHA. The most important thing is to choose reCAPTCHA type as the V3. Once everything completed, submit the form, and finally it'll reveal the "Site Key&lt;br&gt;
" and "Secret Key". You need only these 2 to integrate reCAPTCHA with WPForms.&lt;/p&gt;

&lt;p&gt;Let's jump into WPForms plugin setting section. Navigate to WPForms settings section in Wordpress, and then fill the details as below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nuzEWy78--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/26xigk3b0pzprgtqkrm1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nuzEWy78--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/26xigk3b0pzprgtqkrm1.png" alt="WPForms plugin settings" width="800" height="597"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Replace "Site Key" and "Secret Key" with your credentials.&lt;/p&gt;

&lt;p&gt;Finally you just need to enable the captcha on desired forms. You can simply do this by visiting to "All Forms" section in the plugin, and simply selecting the relevant form.&lt;/p&gt;

&lt;p&gt;If everything went well, you should be able to see the Google reCAPTCHA on your "Contact us" page or any other desired page as below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mBAqXc-0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tnfr4pji1gh071kovnan.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mBAqXc-0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tnfr4pji1gh071kovnan.png" alt="Contact us Google reCAPTCHA" width="800" height="424"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And you can see the analytics of the Google reCAPTCHA, you can check that on the Google reCAPTCHA console dashboard too.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YasQPcIV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lbpqs4l68779iaki67dw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YasQPcIV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lbpqs4l68779iaki67dw.png" alt="Google reCAPTCHA console dashboard" width="800" height="424"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you like to check the visual guide of this, please &lt;a href="https://www.youtube.com/watch?v=S0-WWkRfsL8"&gt;watch this video&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>wordpress</category>
      <category>security</category>
      <category>google</category>
    </item>
    <item>
      <title>Installing Apache or Nginx on Amazon EC2 Linux 2 AMI using a user data script</title>
      <dc:creator>Buddhi Eashwarage</dc:creator>
      <pubDate>Fri, 13 Oct 2023 04:47:02 +0000</pubDate>
      <link>https://dev.to/buddhieash/installing-apache-or-nginx-on-amazon-ec2-linux-2-ami-using-a-user-data-script-4bcb</link>
      <guid>https://dev.to/buddhieash/installing-apache-or-nginx-on-amazon-ec2-linux-2-ami-using-a-user-data-script-4bcb</guid>
      <description>&lt;p&gt;When you're going to host a website on an Amazon EC2 instance by using an Amazon Linux 2 AMI, you need to set up a web server.&lt;/p&gt;

&lt;p&gt;It can be either Apache or Nginx.&lt;/p&gt;

&lt;p&gt;Installing a web server manually by SSH into the instance later once you spin up the instance will be easier when you are dealing with only 1 instance.&lt;/p&gt;

&lt;p&gt;But when you're going to deal with a fleet of instances that will have 3-4 instances, this will be a time-consuming thing. &lt;/p&gt;

&lt;p&gt;Ex:- You're going to configure an ALB (Application Load Balancer) with different target groups. In that case, you'll need to maintain the same web server across several EC2 instances.&lt;/p&gt;

&lt;p&gt;Therefore, the most efficient way is to add a bash script under "User data" section in "Advanced details" when you're going to create an EC2 instance, and before you spin up the instance.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lC0xAYhP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qbwmlr6yh4zjlfwmik4w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lC0xAYhP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qbwmlr6yh4zjlfwmik4w.png" alt="Advanced details" width="800" height="512"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Add the script here.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--StVmioIB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wm2weo7o0nx72lnplf5d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--StVmioIB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wm2weo7o0nx72lnplf5d.png" alt="User data" width="800" height="512"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Script to install Apache web server.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;#!/bin/bash&lt;br&gt;
yum update -y&lt;br&gt;
yum install -y httpd&lt;br&gt;
systemctl start httpd&lt;br&gt;
systemctl enable httpd&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Script to install Nginx web server.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;#!/bin/bash&lt;br&gt;
yum update -y&lt;br&gt;
amazon-linux-extras install nginx1 -y &lt;br&gt;
systemctl enable nginx&lt;br&gt;
systemctl start nginx&lt;/code&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>webdev</category>
      <category>ec2</category>
      <category>linux</category>
    </item>
    <item>
      <title>How to connect AWS Elastic IP with Laravel Forge</title>
      <dc:creator>Buddhi Eashwarage</dc:creator>
      <pubDate>Sat, 26 Aug 2023 06:37:40 +0000</pubDate>
      <link>https://dev.to/buddhieash/how-to-connect-aws-elastic-ip-with-laravel-forge-l2b</link>
      <guid>https://dev.to/buddhieash/how-to-connect-aws-elastic-ip-with-laravel-forge-l2b</guid>
      <description>&lt;p&gt;As you know when Forge provisioning a server in AWS EC2, the instance get allocated private and public IP addresses automatically by AWS itself. &lt;/p&gt;

&lt;p&gt;But if we restart the server from Forge side or AWS side Forge cannot figure it out the newly allocated public IP to the server since it has been changed, and Forge side doesn't have any reference of the latest IP address.&lt;/p&gt;

&lt;p&gt;Therefore, as a workaround we can first allocate an Elastic IP from AWS side first. And then add a reference to that in Forge side.&lt;/p&gt;

&lt;p&gt;Let's see how to do that.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Creating and allocating an Elastic IP from AWS side.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Search for Elastic IP in the AWS console or search for EC2.&lt;/p&gt;

&lt;p&gt;If you search by EC2, go to the EC2 dashboard and in the left panel bottom area you can see the Elastic IPs option. &lt;/p&gt;

&lt;p&gt;Then you can choose 'Allocate Elastic IP' option, and select an Elastic IP from Amazon's pool of IPv4 addresses. &lt;/p&gt;

&lt;p&gt;After that you'll be on 'Elastic IP addresses' dashboard area where you can connect the newly created Elastic IP to the EC2 instance.&lt;/p&gt;

&lt;p&gt;So select the Elastic IP address from the list of addresses, and select 'Associate Elastic IP address'. You can follow the onscreen steps, and select the desired EC2 instance and allocate the IP.&lt;/p&gt;

&lt;p&gt;All done from the AWS side. Now let's move into Forge side. There you need to select the relevant server from the Forge dashboard. Once you're inside the server, you'll see a left menu. Then select the most bottom option which is 'Meta', and it's related to metadata of the server. Once you scroll down a little bit you can see an option call 'Server Metadata'. For the 'IP Address'(Not the 'Private IP Address') field you can add the Elastic IP address which you newly created.&lt;/p&gt;

&lt;p&gt;That's it!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>aws</category>
      <category>ec2</category>
      <category>laravel</category>
    </item>
    <item>
      <title>Building a Menu Bar Desktop Application with NativePHP package in Laravel</title>
      <dc:creator>Buddhi Eashwarage</dc:creator>
      <pubDate>Mon, 21 Aug 2023 12:04:42 +0000</pubDate>
      <link>https://dev.to/buddhieash/building-a-menu-bar-desktop-application-with-nativephp-package-in-laravel-599l</link>
      <guid>https://dev.to/buddhieash/building-a-menu-bar-desktop-application-with-nativephp-package-in-laravel-599l</guid>
      <description>&lt;p&gt;&lt;a href="https://nativephp.com/docs/1/getting-started/introduction#what-exactly-is-nativephp" rel="noopener noreferrer"&gt;NativePHP&lt;/a&gt; package recently introduced and in Laravel it allows us to design and develop cross platform desktop applications. It has inherited from &lt;a href="https://www.electronjs.org/" rel="noopener noreferrer"&gt;Electron&lt;/a&gt; project. In this blog post I'll show how to come-up with a desktop application using Laravel with Blade templates.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Create a new Laravel Project using composer&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;composer create-project laravel/laravel laravel-native-php&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%2Fg1k8p7i6a71cwtjk6zp8.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%2Fg1k8p7i6a71cwtjk6zp8.png" alt="Image0"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Installing NativePHP package&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;composer require nativephp/electron&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%2Fupwf7vtycwi4sqn37shm.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%2Fupwf7vtycwi4sqn37shm.png" alt="Image1"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Run php artisan command in the terminal to check what are the next NativePHP related commands to be executed.&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%2F3hljwlew0dq4saj52t33.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%2F3hljwlew0dq4saj52t33.png" alt="Image2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can see that there is a command to be executed call native:install which will install NativePHP by creating a separate AppServiceProvider for it.&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%2Fv217cy9fme7nq79lpi0v.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%2Fv217cy9fme7nq79lpi0v.png" alt="Image3"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see once executed &lt;strong&gt;php artisan native:install&lt;/strong&gt; command, you'll see it prompts for choosing options for two questions. We just need to select &lt;strong&gt;yes&lt;/strong&gt; for installing the NativePHP NPM dependencies, and select &lt;strong&gt;no&lt;/strong&gt; for starting the NativePHP development server.&lt;/p&gt;

&lt;p&gt;After this point everything should looks good, and we can start the Laravel development server using &lt;strong&gt;php artisan serve&lt;/strong&gt; command.&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%2F63h31wzt7c4wi1d5bfor.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%2F63h31wzt7c4wi1d5bfor.png" alt="Image4"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Nice!! We can see a desktop application has appeared as a normal Laravel web application. The difference is you can see the application menu on Mac menu bar as same as other desktop application. With that we can verify this is a desktop application, and not a web application runs on the browser.&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%2Fv2ldagdz7lmt0d2if3xz.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%2Fv2ldagdz7lmt0d2if3xz.png" alt="Image5"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Furthermore, it has created a dock icon as well.&lt;/p&gt;

&lt;p&gt;Let's customise the code to make it more convenient prior adding some actual business logic to the application.&lt;/p&gt;

&lt;p&gt;TIP: Keep in mind that hot reloading already in place, and when you make some changes to the code, it will reflect on the application interface in real time.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Keep the application on top every time&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;By adding the chain method &lt;strong&gt;alwaysOnTop()&lt;/strong&gt; after calling &lt;strong&gt;Window::open()&lt;/strong&gt; static method, the application will be on top everytime.&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%2Foc1wqvx420j81ukddn9o.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%2Foc1wqvx420j81ukddn9o.png" alt="Image6"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Set width, height, minimum height and minimum width&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Window::open()&lt;br&gt;
        -&amp;gt;alwaysOnTop()&lt;br&gt;
        -&amp;gt;width(400)&lt;br&gt;
        -&amp;gt;height(250)&lt;br&gt;
        -&amp;gt;minWidth(300);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Changing the title&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;We can change the title by adding the following chain method.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-&amp;gt;title('Hey Demo Laravel');&lt;/code&gt;&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%2Fixpp247gxanmagwgyww8.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%2Fixpp247gxanmagwgyww8.png" alt="Image7"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Keep the desktop windows on the same position after hot reload&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-&amp;gt;rememberState();&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;By calling the above chain method the window keeps at the same position even after the hot reload!!&lt;/p&gt;

&lt;p&gt;Furthermore, you can refer to this &lt;a href="https://nativephp.com/docs/1/the-basics/windows" rel="noopener noreferrer"&gt;https://nativephp.com/docs/1/the-basics/windows&lt;/a&gt; for a detailed guide.&lt;/p&gt;

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

</description>
      <category>laravel</category>
      <category>php</category>
      <category>webdev</category>
      <category>development</category>
    </item>
    <item>
      <title>Deploying a Laravel Application on Laravel Forge with AWS | Step-by-Step Guide</title>
      <dc:creator>Buddhi Eashwarage</dc:creator>
      <pubDate>Sun, 30 Jul 2023 11:33:15 +0000</pubDate>
      <link>https://dev.to/buddhieash/deploying-a-laravel-application-on-laravel-forge-with-aws-step-by-step-guide-44m4</link>
      <guid>https://dev.to/buddhieash/deploying-a-laravel-application-on-laravel-forge-with-aws-step-by-step-guide-44m4</guid>
      <description>&lt;p&gt;Deploying a Laravel application to the cloud can be a complex and time-consuming process. However, with the help of Laravel Forge and AWS (Amazon Web Services), developers can streamline this deployment process and ensure a smooth transition from development to production. In this article, we will walk you through the steps to deploy a Laravel application from GitHub to AWS using Laravel Forge.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;Before we dive into the deployment process, make sure you have the following prerequisites in place:&lt;/p&gt;

&lt;p&gt;A Laravel application hosted on GitHub.&lt;br&gt;
An AWS account with proper IAM permissions to create and manage resources like EC2 instances, databases, and S3 buckets.&lt;br&gt;
A Laravel Forge account.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Set Up Laravel Forge
&lt;/h3&gt;

&lt;p&gt;Sign in to your Laravel Forge account or create a new one if you haven't already done so.&lt;/p&gt;

&lt;p&gt;Once logged in, click on the "Connect to a Server" button and follow the instructions to add your AWS account. This process will allow Laravel Forge to manage AWS resources on your behalf.&lt;/p&gt;

&lt;p&gt;Now, connect your GitHub account to Laravel Forge. Head to "Sites" and click on the "Create Site" button. Select "GitHub" as the Git provider and follow the prompts to authorize the connection.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Create a New Server
&lt;/h3&gt;

&lt;p&gt;After connecting to your GitHub account, click on the "Create Server" button in Laravel Forge.&lt;/p&gt;

&lt;p&gt;Choose AWS as the cloud provider and select your desired region.&lt;/p&gt;

&lt;p&gt;Next, select your preferred server size, PHP version, and other configurations according to your application's requirements.&lt;/p&gt;

&lt;p&gt;Laravel Forge will handle server provisioning and automatically configure PHP, Nginx, and other necessary software.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bonus TIP 1&lt;/strong&gt; - Sometimes you may be encounter with an issue when creating the server due to AWS default security group's limitation of the inbound rules for provisioning a server with Laravel Forge. If that's the case, make sure to create a new security group with the following inbound rules and attach that security group to the EC2 instance created by Forge. Refer to this link for the latest documentation on this - &lt;a href="https://forge.laravel.com/docs/1.0/servers/providers.html#amazon-aws-api-access"&gt;https://forge.laravel.com/docs/1.0/servers/providers.html#amazon-aws-api-access&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Configure the Environment and Database
&lt;/h3&gt;

&lt;p&gt;While creating the server, you can set up environment variables required for your Laravel application. These can include database credentials, API keys, and other sensitive information.&lt;/p&gt;

&lt;p&gt;Create a new database server through Laravel Forge or connect to your existing AWS RDS instance.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: Deploy Your Laravel Application
&lt;/h3&gt;

&lt;p&gt;Once your server is ready, go to the "Sites" section in Laravel Forge and click on the site you created.&lt;/p&gt;

&lt;p&gt;Choose the GitHub repository that contains your Laravel application.&lt;/p&gt;

&lt;p&gt;Select the branch you wish to deploy (usually the master branch).&lt;/p&gt;

&lt;p&gt;Click "Deploy Now" to trigger the deployment process. Laravel Forge will clone your repository, install dependencies, and run any necessary migration commands.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5: Set Up SSL (Optional)
&lt;/h3&gt;

&lt;p&gt;Laravel Forge allows you to easily secure your application with SSL certificates. You can either use a free Let's Encrypt certificate or upload a custom SSL certificate.&lt;/p&gt;

&lt;p&gt;Head to the "Security" tab of your site and choose your preferred SSL option.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 6: Monitor and Scale
&lt;/h3&gt;

&lt;p&gt;Laravel Forge provides useful monitoring and notification features. You can set up notifications for deployment failures, server outages, and other critical events.&lt;/p&gt;

&lt;p&gt;As your application grows, you can easily scale your AWS infrastructure by adding more servers or optimizing the existing ones.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bonus TIP 2&lt;/strong&gt; - If you like to refer to a video tutorial on this, please check the following video:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.toYouTube%20Video"&gt;https://www.youtube.com/watch?v=xkZDnPprQtA&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Deploying a Laravel application from GitHub to AWS using Laravel Forge offers developers a straightforward and efficient way to move their projects from development to production. &lt;/p&gt;

&lt;p&gt;With Laravel Forge handling server provisioning, environment configuration, and application deployment, developers can focus on building and improving their Laravel applications without worrying about the underlying infrastructure. &lt;/p&gt;

&lt;p&gt;By combining the power of Laravel Forge and AWS, developers can ensure a reliable and scalable environment for their Laravel applications.&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>aws</category>
      <category>cicd</category>
      <category>devops</category>
    </item>
    <item>
      <title>Microsoft's AZ-900: Empowering the Cloud Journey with Azure Fundamentals</title>
      <dc:creator>Buddhi Eashwarage</dc:creator>
      <pubDate>Tue, 25 Jul 2023 04:32:02 +0000</pubDate>
      <link>https://dev.to/buddhieash/microsofts-az-900-empowering-the-cloud-journey-with-azure-fundamentals-459l</link>
      <guid>https://dev.to/buddhieash/microsofts-az-900-empowering-the-cloud-journey-with-azure-fundamentals-459l</guid>
      <description>&lt;p&gt;In today's digitally-driven world, the cloud has become the backbone of modern technology, powering countless businesses and organizations across the globe. Microsoft, a pioneer in the tech industry, recognized the growing importance of cloud computing early on and has developed a comprehensive certification program to equip individuals with the necessary knowledge to harness the power of the cloud. The Exam AZ-900: Microsoft Azure Fundamentals is the gateway to understanding and leveraging the potential of Microsoft Azure. Even more enticingly, Microsoft offers this certification along with free training, making it accessible to anyone aspiring to thrive in the cloud ecosystem.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Unlocking the Potential of Azure with AZ-900&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Microsoft Azure Fundamentals (AZ-900) exam is designed for individuals who are new to the cloud domain or those looking to validate their fundamental knowledge of cloud concepts. The exam covers foundational topics, such as cloud computing concepts, core Azure services, security, privacy, compliance, and pricing. As the first step in Microsoft's Azure certification path, AZ-900 sets the stage for more specialized Azure certifications for those looking to advance their careers further.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Free Training: Empowering Learners Globally&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;One of the most significant advantages of AZ-900 is that Microsoft offers free training to help learners prepare for the exam. This generous initiative is part of Microsoft's commitment to empower individuals worldwide with the skills needed to excel in the cloud industry. Through the Microsoft Learn platform, candidates can access a wealth of study materials, interactive modules, and hands-on labs that cater to diverse learning styles.&lt;/p&gt;

&lt;p&gt;The free training resources provide a structured and comprehensive approach, ensuring that candidates grasp the core concepts effectively. Learners can progress at their own pace, which is particularly beneficial for those juggling work, studies, or other commitments. Additionally, the platform provides knowledge checks and quizzes to assess understanding and offer valuable feedback, allowing candidates to focus on their areas of improvement.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;No-Cost Certification: Paving the Way to Success&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Besides offering free training, Microsoft takes it a step further by providing eligible candidates with the opportunity to take the AZ-900 exam at no cost. This remarkable initiative significantly reduces the financial barriers that might otherwise prevent individuals from pursuing the certification. By eliminating the exam fee, Microsoft aims to empower a more diverse pool of learners, ensuring that talent and dedication, rather than financial constraints, become the key factors in unlocking new career opportunities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to Take Advantage of the Offer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To benefit from Microsoft's free AZ-900 training and certification offer, candidates can follow these simple steps:&lt;/p&gt;

&lt;p&gt;Access Microsoft Learn: Visit the Microsoft Learn platform (learn.microsoft.com) to access the free training materials for AZ-900. Create an account to track progress and access additional features.&lt;/p&gt;

&lt;p&gt;Prepare and Study: Utilize the diverse range of learning resources provided by Microsoft to prepare for the exam thoroughly. The platform offers various formats, including text, videos, and hands-on labs, to cater to different learning preferences.&lt;/p&gt;

&lt;p&gt;Register for the Exam: Once confident in the knowledge acquired, candidates can register for the AZ-900 exam through the Microsoft certification website.&lt;/p&gt;

&lt;p&gt;Take the Exam: With the exam registration complete, candidates can schedule the exam and take it online or at an authorized testing center.&lt;/p&gt;

&lt;p&gt;Certification and Beyond: After successfully passing the exam, candidates receive the Microsoft Certified: Azure Fundamentals certification. This achievement can serve as a stepping stone to other advanced Azure certifications, enhancing career prospects and opening doors to exciting opportunities in the cloud industry.&lt;/p&gt;

&lt;p&gt;Microsoft's Exam AZ-900: Microsoft Azure Fundamentals is not just a certification; it's a gateway to the world of cloud computing and a pathway to a brighter future. By offering this certification along with free training and no-cost exams, Microsoft demonstrates its commitment to fostering an inclusive and skilled workforce, ready to embrace the potential of cloud technology. Whether you're a student, a professional looking to upskill, or someone simply interested in the world of cloud computing, AZ-900 is your ticket to embark on an exciting cloud journey with Microsoft Azure. Seize this opportunity and join the thriving community of cloud enthusiasts today!&lt;/p&gt;

</description>
      <category>azure</category>
      <category>devops</category>
      <category>webdev</category>
      <category>cloudcomputing</category>
    </item>
    <item>
      <title>How to Install Jenkins on AWS EC2 and Deploy Changes to Apache Server</title>
      <dc:creator>Buddhi Eashwarage</dc:creator>
      <pubDate>Sat, 22 Jul 2023 05:55:32 +0000</pubDate>
      <link>https://dev.to/buddhieash/how-to-install-jenkins-on-aws-ec2-and-deploy-changes-to-apache-server-1c2c</link>
      <guid>https://dev.to/buddhieash/how-to-install-jenkins-on-aws-ec2-and-deploy-changes-to-apache-server-1c2c</guid>
      <description>&lt;p&gt;Jenkins is a powerful open-source automation server that facilitates continuous integration and continuous deployment (CI/CD) in software development projects. In this article, we will guide you through the process of setting up Jenkins on an Amazon Web Services (AWS) Elastic Compute Cloud (EC2) instance and automating the deployment of changes to an Apache web server. This will enable you to streamline your development workflow and ensure smooth and efficient software deployment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before we begin, make sure you have the following prerequisites in place:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;An AWS account with the necessary permissions to create EC2 instances and configure security groups.&lt;/li&gt;
&lt;li&gt;Familiarity with basic Linux commands and the AWS Management Console.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 1: Launch an EC2 Instance
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Log in to your AWS Management Console.&lt;/li&gt;
&lt;li&gt;Navigate to the EC2 dashboard.&lt;/li&gt;
&lt;li&gt;Click on "Launch Instance" to create a new EC2 instance.&lt;/li&gt;
&lt;li&gt;Select an Amazon Linux AMI or any other suitable Linux distribution of your choice.&lt;/li&gt;
&lt;li&gt;Choose an instance type based on your requirements. A t2.micro instance will suffice for this demonstration.&lt;/li&gt;
&lt;li&gt;Configure the instance details (e.g., network, subnet, IAM role).&lt;/li&gt;
&lt;li&gt;Add storage as needed for your Jenkins installation.&lt;/li&gt;
&lt;li&gt;Configure security groups to allow inbound traffic on port 8080 (Jenkins web interface) and port 22 (SSH access). Additionally, open port 80 if your Apache server is already running.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 2: Connect to Your EC2 Instance
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;After the instance is launched, select it in the EC2 dashboard.&lt;/li&gt;
&lt;li&gt;Click on the "Connect" button to view connection options.&lt;/li&gt;
&lt;li&gt;Use SSH to connect to your EC2 instance using the provided Public DNS or IP address:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   ssh -i /path/to/your/key.pem ec2-user@your-ec2-public-dns
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3: Install Java
&lt;/h2&gt;

&lt;p&gt;Jenkins requires Java to run. Amazon Linux usually comes with OpenJDK installed, but let's make sure we have Java installed:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Update the package list:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   sudo yum update -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Install Java:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   sudo yum install java-1.8.0-openjdk-devel -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Check Java version:
&lt;/li&gt;
&lt;/ol&gt;

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 4: Install Jenkins
&lt;/h2&gt;

&lt;p&gt;Now that Java is installed, let's proceed with installing Jenkins:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Add the Jenkins repository to your system:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Import the Jenkins repository key:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Install Jenkins:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   sudo yum install jenkins -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Start the Jenkins service:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   sudo service jenkins start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Enable Jenkins to start on system boot:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   sudo chkconfig jenkins on
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;For the latest Jenkins installation instructions can be found through the  &lt;a href="https://www.jenkins.io/doc/book/installing/linux/"&gt;Jenkins official installation guide&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Access Jenkins Web Interface
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Open a web browser and access Jenkins using your EC2 instance's public IP address or Public DNS on port 8080:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   http://your-ec2-public-ip:8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;You will be prompted to enter an initial administrator password. Retrieve it using the following command on your EC2 instance:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   sudo cat /var/lib/jenkins/secrets/initialAdminPassword
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Copy and paste the password into the Jenkins web interface.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Follow the setup wizard to install suggested plugins and create an admin user.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 6: Install Required Plugins
&lt;/h2&gt;

&lt;p&gt;To deploy changes to the Apache server, we will use the "Publish Over SSH" plugin. Here's how to install it:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the Jenkins web interface, click on "Jenkins" in the top-left corner to go back to the dashboard.&lt;/li&gt;
&lt;li&gt;Click on "Manage Jenkins" on the left-hand side.&lt;/li&gt;
&lt;li&gt;Select "Manage Plugins."&lt;/li&gt;
&lt;li&gt;Navigate to the "Available" tab and search for "Publish Over SSH."&lt;/li&gt;
&lt;li&gt;Check the box next to "Publish Over SSH" and click on "Install without restart."&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 7: Configure Jenkins Credentials
&lt;/h2&gt;

&lt;p&gt;Before we can deploy changes via SSH, Jenkins needs SSH credentials to access your Apache server:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the Jenkins web interface, click on "Jenkins" in the top-left corner to go back to the dashboard.&lt;/li&gt;
&lt;li&gt;Click on "Credentials" on the left-hand side.&lt;/li&gt;
&lt;li&gt;Under "Stores scoped to Jenkins," click on "Jenkins."&lt;/li&gt;
&lt;li&gt;Click on "Global credentials (unrestricted)."&lt;/li&gt;
&lt;li&gt;Click on "Add Credentials" on the left-hand side.&lt;/li&gt;
&lt;li&gt;Select "SSH Username with private key" from the "Kind" dropdown.&lt;/li&gt;
&lt;li&gt;Enter your SSH private key or provide the path to your private key file.&lt;/li&gt;
&lt;li&gt;Add a description and username for your credentials, and click "Save."&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 8: Create a Jenkins Job for Deployment
&lt;/h2&gt;

&lt;p&gt;Now, let's create a Jenkins job to automate the deployment of changes to the Apache server:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the Jenkins web interface, click on "New Item" on the left-hand side.&lt;/li&gt;
&lt;li&gt;Enter a name for your job (e.g., "Deploy to Apache Server") and select "Freestyle project."&lt;/li&gt;
&lt;li&gt;Click "OK" to create the job.&lt;/li&gt;
&lt;li&gt;Scroll down to the "Build" section and click on "Add build step."&lt;/li&gt;
&lt;li&gt;Select "Send files or execute commands over SSH" from the dropdown.&lt;/li&gt;
&lt;li&gt;Choose the SSH server you configured earlier.&lt;/li&gt;
&lt;li&gt;In the "Source files" field, enter the path to the files you want to deploy (e.g., &lt;code&gt;./dist/*&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;In the "Remove prefix" field, enter the relative path to the files from the Jenkins workspace, if applicable.&lt;/li&gt;
&lt;li&gt;In the "Remote directory" field, enter the path on the Apache server where you want to deploy the files (e.g., &lt;code&gt;/var/www/html&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Click "Save" to save the job configuration.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 9: Trigger the Deployment
&lt;/h2&gt;

&lt;p&gt;Now that the job is set up, you can manually trigger the deployment:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go back to the Jenkins dashboard.&lt;/li&gt;
&lt;li&gt;Find your "Deploy to Apache Server" job and click on it.&lt;/li&gt;
&lt;li&gt;Click on "Build Now" to trigger the deployment.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Jenkins will now connect to your Apache server via SSH and deploy the changes specified in the job configuration.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Congratulations! You have successfully installed Jenkins on an AWS EC2 instance and set up a Jenkins job to automate the deployment of changes to your Apache web server. With Jenkins managing your CI/CD pipeline, you can enjoy faster and more reliable software deployments, enhancing your development workflow and overall productivity. Remember to monitor your Jenkins jobs regularly, and feel free to explore other Jenkins plugins and features to further enhance your automation process. Happy coding!&lt;/p&gt;

</description>
      <category>devops</category>
      <category>jenkins</category>
      <category>aws</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Playing with ChatGPT to generate dummy/fake data.</title>
      <dc:creator>Buddhi Eashwarage</dc:creator>
      <pubDate>Mon, 06 Mar 2023 04:35:58 +0000</pubDate>
      <link>https://dev.to/buddhieash/playing-with-chatgpt-to-generate-dummyfake-data-1136</link>
      <guid>https://dev.to/buddhieash/playing-with-chatgpt-to-generate-dummyfake-data-1136</guid>
      <description>&lt;p&gt;If you're a software engineer, you know how important dummy data!!&lt;/p&gt;

&lt;p&gt;When you need to test some piece of software locally which interacts with data, it's crucial to have a set of dummy data created.&lt;/p&gt;

&lt;p&gt;One way to do that is generating the dummy data manually which is the old school way.&lt;/p&gt;

&lt;p&gt;But nowadays we can use a free open source library to accomplish this task.&lt;/p&gt;

&lt;p&gt;People who have exposed to PHP, well aware with FakerPHP library. And if you are using some framework like Laravel, it has a seperate Seeder class which allows to seed the database tables with dummy data.&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%2F1joxvnq3owe6grwekhyy.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%2F1joxvnq3owe6grwekhyy.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Therefore, we can call FakerPHP helper methods to generate dummy or fake data for us. &lt;/p&gt;

&lt;p&gt;But with all these libraries we can't see the generated data until the process is completed since it's a direct interaction with the database behind the scene.&lt;/p&gt;

&lt;p&gt;I think we can use ChatGPT to overcome from this issue. While some people bothering whether ChatGPT will take over all the software engineering jobs, we can find smarter ways to use it to improve the efficiency as software engineers.&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%2Fqsuy46s5l2ikj4roxn2h.jpg" 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%2Fqsuy46s5l2ikj4roxn2h.jpg" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
Let's jump into ChatGPT and let's start with a dummy data table prior exploring the database seeders.&lt;/p&gt;

&lt;p&gt;Simply I started with the following command.&lt;/p&gt;

&lt;p&gt;My intention is to create a dummy product data table with the given parameters when creating a product.&lt;br&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%2Fzdhwm2n2hyookvpdpf5q.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%2Fzdhwm2n2hyookvpdpf5q.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What will be the ChatGPT's reply?&lt;/p&gt;

&lt;p&gt;This is the reply.&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%2Fz29fuvuhjnigaoiufcjm.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%2Fz29fuvuhjnigaoiufcjm.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It not only created a table filled with dummy data, but also provided a brief explanation too. How awesome right?&lt;/p&gt;

&lt;p&gt;Then my idea was to convert those dummy data into JSON format which permits me later to copy and paste during my data populating process.&lt;/p&gt;

&lt;p&gt;So I asked the following question.&lt;br&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%2Fblcixik63skvdrf7idy5.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%2Fblcixik63skvdrf7idy5.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It was smart enough to provide me the generated data in JSON format.&lt;br&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%2F54f7w9915gp81sq8972u.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%2F54f7w9915gp81sq8972u.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the complete output.&lt;br&gt;
&lt;code&gt;[&lt;br&gt;
  {&lt;br&gt;
    "name": "Widget A",&lt;br&gt;
    "sku": "WIDG001",&lt;br&gt;
    "quantity": 10,&lt;br&gt;
    "price": 29.99&lt;br&gt;
  },&lt;br&gt;
  {&lt;br&gt;
    "name": "Widget B",&lt;br&gt;
    "sku": "WIDG002",&lt;br&gt;
    "quantity": 5,&lt;br&gt;
    "price": 14.99&lt;br&gt;
  },&lt;br&gt;
  {&lt;br&gt;
    "name": "Widget C",&lt;br&gt;
    "sku": "WIDG003",&lt;br&gt;
    "quantity": 20,&lt;br&gt;
    "price": 9.99&lt;br&gt;
  },&lt;br&gt;
  {&lt;br&gt;
    "name": "Thingamajig X",&lt;br&gt;
    "sku": "THING001",&lt;br&gt;
    "quantity": 15,&lt;br&gt;
    "price": 49.99&lt;br&gt;
  },&lt;br&gt;
  {&lt;br&gt;
    "name": "Thingamajig Y",&lt;br&gt;
    "sku": "THING002",&lt;br&gt;
    "quantity": 7,&lt;br&gt;
    "price": 99.99&lt;br&gt;
  },&lt;br&gt;
  {&lt;br&gt;
    "name": "Thingamajig Z",&lt;br&gt;
    "sku": "THING003",&lt;br&gt;
    "quantity": 3,&lt;br&gt;
    "price": 199.99&lt;br&gt;
  }&lt;br&gt;
]&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
End of the response it had provided a brief explanation again as below.&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%2Fjkmhgiegqr6cq9bwwp3f.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%2Fjkmhgiegqr6cq9bwwp3f.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Do you think I stopped from there? NO!!&lt;/p&gt;

&lt;p&gt;I wanted to check whether it can provide a specific PHP framework oriented solution.&lt;/p&gt;

&lt;p&gt;So I asked the following question.&lt;br&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%2Fy9znl50xwm325o2mnvif.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%2Fy9znl50xwm325o2mnvif.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It started to guide me with a step by step approach which was really cool.&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%2F4qy5qetpqwqsytksgcev.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%2F4qy5qetpqwqsytksgcev.png" alt="Image description"&gt;&lt;/a&gt;&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%2Fj0n8z6lwhbpx5obyokw5.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%2Fj0n8z6lwhbpx5obyokw5.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Complete code.&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;Illuminate\Database\Seeder&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="no"&gt;Illuminate\Support\Facades\DB&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;ProductsTableSeeder&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Seeder&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="cd"&gt;/**
     * Run the database seeds.
     *
     * @return void
     */&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;run&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nv"&gt;$products&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="s1"&gt;'name'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Widget A'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'sku'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'WIDG001'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'quantity'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'price'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mf"&gt;29.99&lt;/span&gt;
            &lt;span class="p"&gt;],&lt;/span&gt;
            &lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="s1"&gt;'name'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Widget B'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'sku'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'WIDG002'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'quantity'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'price'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mf"&gt;14.99&lt;/span&gt;
            &lt;span class="p"&gt;],&lt;/span&gt;
            &lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="s1"&gt;'name'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Widget C'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'sku'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'WIDG003'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'quantity'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'price'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mf"&gt;9.99&lt;/span&gt;
            &lt;span class="p"&gt;],&lt;/span&gt;
            &lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="s1"&gt;'name'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Thingamajig X'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'sku'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'THING001'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'quantity'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'price'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mf"&gt;49.99&lt;/span&gt;
            &lt;span class="p"&gt;],&lt;/span&gt;
            &lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="s1"&gt;'name'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Thingamajig Y'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'sku'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'THING002'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'quantity'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'price'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mf"&gt;99.99&lt;/span&gt;
            &lt;span class="p"&gt;],&lt;/span&gt;
            &lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="s1"&gt;'name'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Thingamajig Z'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'sku'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'THING003'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'quantity'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s1"&gt;'price'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mf"&gt;199.99&lt;/span&gt;
            &lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="p"&gt;];&lt;/span&gt;

        &lt;span class="no"&gt;DB&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;table&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="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;insert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$products&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;End of the code as usual it was giving a brief explanation as well.&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%2Fv5uoijr8lgqn00w6yhxd.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%2Fv5uoijr8lgqn00w6yhxd.png" alt="Image description"&gt;&lt;/a&gt;&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%2Ff5hlffs2upqjarsjv0tt.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%2Ff5hlffs2upqjarsjv0tt.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

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

</description>
      <category>chatgpt</category>
      <category>database</category>
      <category>laravel</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
