<?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>Forem: Adi Sk</title>
    <description>The latest articles on Forem by Adi Sk (@adi).</description>
    <link>https://forem.com/adi</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%2F29112%2Faa7a8304-89d1-4876-ad01-29205fae1b3a.png</url>
      <title>Forem: Adi Sk</title>
      <link>https://forem.com/adi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/adi"/>
    <language>en</language>
    <item>
      <title>How to load custom JSON files into Laravel's config</title>
      <dc:creator>Adi Sk</dc:creator>
      <pubDate>Tue, 30 Jun 2020 09:20:26 +0000</pubDate>
      <link>https://forem.com/adi/how-to-load-custom-json-files-into-laravel-s-config-2fce</link>
      <guid>https://forem.com/adi/how-to-load-custom-json-files-into-laravel-s-config-2fce</guid>
      <description>&lt;p&gt;Hi All, this is Adi, again with another Laravel blog post. This time I wanted to share my solution to loading custom settings from a JSON file into Laravel’s config. Firstly what’s the use case for this, there was a client project, where they had a huge list of configurations in a JSON file and I had to use them in the code. An ideal solution for this could be storing these settings in the database and query them on demand, but I was not able to persuade them to this option, so here’s my solution to how I did it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Loading the Settings file
&lt;/h3&gt;

&lt;p&gt;First, let’s see how to load this file when the app initializes.&lt;/p&gt;

&lt;p&gt;In the code below I load the &lt;code&gt;settings.json&lt;/code&gt; that's in the &lt;code&gt;storage&lt;/code&gt; folder in my &lt;code&gt;AppServiceProvider&lt;/code&gt;'s boot method. But if you have a lot more logic happening in your service provider you can create a new one just for this purpose.&lt;/p&gt;

&lt;p&gt;I check if the file exists, if so, I decode the JSON into a PHP &lt;code&gt;array&lt;/code&gt; then add it to the app config. Now you are able to access all the key's from the settings file as &lt;code&gt;config('settings.name')&lt;/code&gt; or whatever the key is.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--u83lNycE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/wty4f9v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--u83lNycE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/wty4f9v.png" alt="Loading the settings file"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Writing the Settings file
&lt;/h3&gt;

&lt;p&gt;Now let's see how to edit or write to this file when you need to make new changes to the config.&lt;/p&gt;

&lt;p&gt;In the below code, I show an example of getting the whole settings file's contents and saving it to the file. But you can customize this for your own need, let's say you just need to edit one property, you can do this by updating your config like so &lt;code&gt;config(['settings.name' =&amp;gt; 'New Value'])&lt;/code&gt; and you could &lt;code&gt;json_encode(config('settings'))&lt;/code&gt; and save the results to the file system.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TjQ7SAoz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/RN3njOa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TjQ7SAoz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/RN3njOa.png" alt="Writing the settings file"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;I hope this gives you some idea of how to handle JSON config files in your Laravel app. The code example I gave you might be basic but you can extend this to your own needs. Be cautious since you're reading and writing to the file system directly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For more Laravel resources visit &lt;a href="https://bestoflaravel.com/?utm_campaign=laravel-json-config-article"&gt;BestOfLaravel.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Thank You&lt;br&gt;
That's all for now, this has been Adi.&lt;br&gt;
If you are looking for a Freelance Web Developer you can &lt;a href="https://simplestweb.in/contact-me/?utm_campaign=laravel-json-config-article"&gt;contact me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>laravel</category>
      <category>php</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to setup Specific Subdomain routing in Laravel</title>
      <dc:creator>Adi Sk</dc:creator>
      <pubDate>Thu, 28 May 2020 11:53:07 +0000</pubDate>
      <link>https://forem.com/adi/how-to-setup-specific-subdomain-routing-in-laravel-3e1f</link>
      <guid>https://forem.com/adi/how-to-setup-specific-subdomain-routing-in-laravel-3e1f</guid>
      <description>&lt;p&gt;Hi all, this is Adi, again with another Laravel post. In one of my recent projects, I had to set up specific subdomain routing within the same Laravel application. This was something new to me because on most projects, I just work with one domain and everything is accessed &lt;code&gt;/&lt;/code&gt; after it. I am going to share with you how I solved it, I hope it gives you some ideas when you are faced to do this too. Let’s get started.&lt;/p&gt;

&lt;h3&gt;
  
  
  What was my need
&lt;/h3&gt;

&lt;p&gt;First, let's explore my requirements for this project. My client wanted to access the admin portal from the &lt;code&gt;admin.myapp.com&lt;/code&gt; domain, the marketing website from &lt;code&gt;myapp.com&lt;/code&gt;, and the API from &lt;code&gt;api.myapp.com&lt;/code&gt;. As you can see it defers from Laravel's defaults. By default, Laravel exposes API routes in &lt;code&gt;myapp.com/api&lt;/code&gt; url and everything else in &lt;code&gt;myapp.com/&lt;/code&gt; domain.&lt;/p&gt;

&lt;h3&gt;
  
  
  My Solution
&lt;/h3&gt;

&lt;p&gt;Laravel routing provides a convenient way to setup subdomain routing but it works best only when you have a wildcard routing, this &lt;code&gt;*.myapp.com&lt;/code&gt; works but to make specific subdomain to work, I had to do some config changes as well. Below is my &lt;code&gt;routes\web.php&lt;/code&gt; file.&lt;/p&gt;

&lt;h4&gt;
  
  
  Routes File
&lt;/h4&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%2Fimgur.com%2F8OXMswG.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%2Fimgur.com%2F8OXMswG.png" alt="My routes file"&gt;&lt;/a&gt;&lt;br&gt;
As you can see, you can use the &lt;code&gt;domain&lt;/code&gt; method to mention the subdomain you want to capture, but it becomes complicated when you have multiple environments with different domains you need to use, that's why I have added the &lt;code&gt;SITE_URL&lt;/code&gt; variable to my &lt;code&gt;.env&lt;/code&gt; file. So when I am developing locally I can set it to &lt;code&gt;localhost&lt;/code&gt;, when in production I set the actual domain, and when in staging or testing I can set the relevant domains.&lt;/p&gt;

&lt;h4&gt;
  
  
  .env Config
&lt;/h4&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%2Fimgur.com%2FGigA5FT.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%2Fimgur.com%2FGigA5FT.png" alt="My .env config file"&gt;&lt;/a&gt;&lt;br&gt;
It's just another .env variable you set. Pretty simple.&lt;/p&gt;

&lt;h3&gt;
  
  
  Webserver Config
&lt;/h3&gt;

&lt;p&gt;Now you have the routing configured but you need to make a few changes in the webserver setup also to be able to use multiple domain names for the same host. Let's see how.&lt;/p&gt;

&lt;h4&gt;
  
  
  Local development
&lt;/h4&gt;

&lt;p&gt;I use a windows PC for development, I had to change my &lt;code&gt;hosts&lt;/code&gt; files in the &lt;code&gt;system32&lt;/code&gt; folder. I added these entries.&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%2Fi.imgur.com%2F4ktrLGc.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%2Fi.imgur.com%2F4ktrLGc.png" alt="My Hosts file config"&gt;&lt;/a&gt;&lt;br&gt;
Now, if you go to any of these domains, it should be routed to your Laravel application, when it's being served.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;I hope this post helped you. It's not daily that you come across a config like this, that's why I decided to share it. If you would like me to cover a specific issue you have with Laravel, do let me know I'll try to write a post about it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Related Resources&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://laravel.com/docs/7.x/routing#route-group-subdomain-routing" rel="noopener noreferrer"&gt;Laravel domain routing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.serverlab.ca/tutorials/linux/web-servers-linux/how-to-configure-multiple-domains-with-nginx-on-ubuntu/" rel="noopener noreferrer"&gt;Nginx config for multiple domains&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://geekflare.com/multiple-domains-on-one-server-with-apache-nginx/" rel="noopener noreferrer"&gt;Apache config for multiple domains&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Thank You&lt;br&gt;
That's all for now, this has been Adi.&lt;br&gt;&lt;br&gt;
If you are looking for a Freelance Web Developer you can &lt;a href="https://simplestweb.in/contact-me/?utm_campaign=laravel-helper-article" rel="noopener noreferrer"&gt;contact me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>laravel</category>
      <category>php</category>
      <category>tutorial</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Create custom Laravel Helper Methods</title>
      <dc:creator>Adi Sk</dc:creator>
      <pubDate>Wed, 22 Apr 2020 19:32:44 +0000</pubDate>
      <link>https://forem.com/adi/create-custom-laravel-helper-methods-2d8m</link>
      <guid>https://forem.com/adi/create-custom-laravel-helper-methods-2d8m</guid>
      <description>&lt;p&gt;Hi All, this is Adi, with another Laravel article. I wanted to take some time to explain what Laravel’s Helper methods are and how your can create your own ones. I was never a big fan of creating my own customer helper methods when I started with Laravel, but with time, I have started using them more often and these days there’s no Laravel project without customer helpers.&lt;/p&gt;

&lt;p&gt;Let’s get started.&lt;/p&gt;

&lt;h3&gt;
  
  
  What are Laravel Helpers
&lt;/h3&gt;

&lt;p&gt;Laravel Helper methods are "plain old" PHP functions, that you can call from any part of your Laravel Application. You may have already used a lot of Laravel's built-in helper methods like &lt;code&gt;route()&lt;/code&gt;, &lt;code&gt;url()&lt;/code&gt;, &lt;code&gt;view()&lt;/code&gt;, &lt;code&gt;dd()&lt;/code&gt;, and a list of others. You do not have to require any PHP files or reference any &lt;code&gt;namespace&lt;/code&gt; to use them, they are &lt;strong&gt;&lt;em&gt;magically&lt;/em&gt;&lt;/strong&gt; available in all parts of your application. I'll explain more about the magic part in just a moment.&lt;/p&gt;

&lt;p&gt;Here are a few use cases for creating custom helper methods. To call other utility classes, if there's a generic logic that's used multiple times in your code you might want to extract it out into a helper. I extensively use helpers to make &lt;strong&gt;&lt;em&gt;formatting&lt;/em&gt;&lt;/strong&gt; easier in my Blade view, such as automatically adding a currency symbol before a number or to format a number in a certain digit grouping or set dates in your application to use the same format on display.&lt;/p&gt;

&lt;p&gt;Now let's see how simple it is to create custom Helper methods.&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating Custom Helpers
&lt;/h3&gt;

&lt;p&gt;It is as simple as creating a file somewhere in the &lt;code&gt;app&lt;/code&gt; directory and inform &lt;code&gt;composer&lt;/code&gt; to auto-load it when the application starts, simple is it not. I usually have all my helper functions in a single file called &lt;code&gt;Helpers.php&lt;/code&gt; in the &lt;code&gt;app/Utils/&lt;/code&gt; folder, this is where I store all my utility classes but you can create this file anywhere in the &lt;code&gt;app&lt;/code&gt; directory you see fit. Then, you need to register this file in your &lt;code&gt;composer.json&lt;/code&gt; file that's at the root of your project. For reference you can check out how the Laravel framework registers it's helpers &lt;a href="https://github.com/laravel/framework/blob/7.x/composer.json" rel="noopener noreferrer"&gt;here&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%2Fimgur.com%2FfhfUW7p.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%2Fimgur.com%2FfhfUW7p.png" alt="composer config"&gt;&lt;/a&gt;&lt;br&gt;
And that's it. Make sure to run this command &lt;code&gt;composer dump-autoload&lt;/code&gt; and restart your application. This will make sure that the &lt;code&gt;Helper.php&lt;/code&gt; is loaded when Laravel is started. Now let's define your first helper method in the &lt;code&gt;Helper.php&lt;/code&gt; file.&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%2Fimgur.com%2FYybJZcY.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%2Fimgur.com%2FYybJZcY.png" alt="create customer helper"&gt;&lt;/a&gt;&lt;br&gt;
This &lt;code&gt;say_hi&lt;/code&gt; method can now be accessed in any part of your application. It's a simple example but you can make it as complex as needed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;I hope you found this article on Laravel helpful. Laravel Helpers are such a handy feature that saves a lot of time. Hope you see the reasons to create your custom ones.&lt;/p&gt;

&lt;p&gt;Useful Resources:&lt;br&gt;
&lt;a href="https://laravel.com/docs/7.x/helpers" rel="noopener noreferrer"&gt;https://laravel.com/docs/7.x/helpers&lt;/a&gt;&lt;br&gt;
&lt;a href="https://laravel.com/docs/7.x/facades#facades-vs-helper-functions" rel="noopener noreferrer"&gt;https://laravel.com/docs/7.x/facades#facades-vs-helper-functions&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Thank You&lt;br&gt;
That's all for now, this has been Adi.&lt;br&gt;&lt;br&gt;
If you are looking for a Freelance Web Developer you can &lt;a href="https://simplestweb.in/contact-me/?utm_campaign=laravel-helper-article" rel="noopener noreferrer"&gt;contact me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>php</category>
      <category>laravel</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>What are Laravel Resource Controllers</title>
      <dc:creator>Adi Sk</dc:creator>
      <pubDate>Sat, 28 Mar 2020 06:27:10 +0000</pubDate>
      <link>https://forem.com/adi/what-are-laravel-resource-controllers-a46</link>
      <guid>https://forem.com/adi/what-are-laravel-resource-controllers-a46</guid>
      <description>&lt;p&gt;Hi all, this is Adi again for a Laravel post. I recently found a lot of questions on StackOverflow asking what Laravel Resource controllers were. I wanted to explain this basic concept. Read on.&lt;/p&gt;

&lt;h3&gt;
  
  
  Laravel Resource Controller
&lt;/h3&gt;

&lt;p&gt;Resource controllers are just Laravel controllers with all the methods to create, read, update and delete a resource (or a Model). You can create a resource controller with this &lt;code&gt;artisan&lt;/code&gt; command&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;br&gt;
php artisan make:controller PhotoController --resource&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This command will create a &lt;code&gt;PhotoController.php&lt;/code&gt; in your controller directory and will have automatically created 7 methods &lt;code&gt;index&lt;/code&gt;, &lt;code&gt;show&lt;/code&gt;, &lt;code&gt;create&lt;/code&gt;, &lt;code&gt;store&lt;/code&gt;, &lt;code&gt;edit&lt;/code&gt;, &lt;code&gt;update&lt;/code&gt;, &lt;code&gt;destroy&lt;/code&gt;. All these methods will be empty, you will have to fill them with the logic for each action. By default, when you execute the command, Laravel will use the model name from the controller, eg. &lt;code&gt;Photo&lt;/code&gt; model will be used for &lt;code&gt;PhotoController&lt;/code&gt;, if you want to use a different model you could use &lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;br&gt;
php artisan make:controller PhotoController --resource --model=Photo&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now the new controller will you what you mention in the &lt;code&gt;--model&lt;/code&gt; flag.&lt;/p&gt;

&lt;p&gt;You could also create controllers for your API routes using the &lt;code&gt;--api&lt;/code&gt; flag instead of &lt;code&gt;--resource&lt;/code&gt; flag. This will create all the methods except the &lt;code&gt;create&lt;/code&gt; and &lt;code&gt;edit&lt;/code&gt; methods, as they are not required for an api call.&lt;/p&gt;
&lt;h3&gt;
  
  
  Laravel Resource Route
&lt;/h3&gt;

&lt;p&gt;Laravel also provides an easy way to make routes for Resource controllers using&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Route::resource('photos', 'PhotoController');
//  GET    /photos            PhotoController@index
//  GET    /photos/create     PhotoController@create
//  POST   /photos            PhotoController@store
//  GET    /photos/{id}       PhotoController@show
//  GET    /photos/{id}/edit  PhotoController@edit
//  PUT    /photos/{id}       PhotoController@update
//  DELETE /photos/{id}       PhotoController@destory
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This method will create all the 7 routes needed to access each action from the browser. You could customize this to create only certain routes you need or leave what you don't need like so.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Route::resource('photos', 'PhotoController')-&amp;gt;only(['index', 'show']);

Route::resource('photos', 'PhotoController')-&amp;gt;except(['create', 'store', 'update', 'destroy']);
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;I hope your doubts about what Laravel Resources controller have been cleared and may want to try this in your next project. Hope this small piece helped you understand them a little better.&lt;/p&gt;

&lt;p&gt;For more information, you could look up &lt;a href="https://laravel.com/docs/7.x/controllers#resource-controllers"&gt;the docs&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;That’s all for now, this has been Adi.&lt;br&gt;&lt;br&gt;
If you are looking for a Freelance Web Developer you can &lt;a href="https://simplestweb.in/contact-me?utm_campaign=laravel-resource-ctl"&gt;contact me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>laravel</category>
      <category>php</category>
      <category>tutorial</category>
      <category>webdev</category>
    </item>
    <item>
      <title>SimplestWeb Updated</title>
      <dc:creator>Adi Sk</dc:creator>
      <pubDate>Tue, 18 Feb 2020 10:21:49 +0000</pubDate>
      <link>https://forem.com/adi/simplestweb-updated-3dh8</link>
      <guid>https://forem.com/adi/simplestweb-updated-3dh8</guid>
      <description>&lt;p&gt;Hi All, I have some great news about Simplest Web. I've decided it's time to take my freelance efforts to the next level, find an office space to work from. It was one of my goals for 2020 to find an office for Simplest Web. This goal came true sooner than I expected. It was in December when I had the thought that it might be time to up the scale of my Software Development Services.&lt;/p&gt;

&lt;p&gt;So far, I had been working from home and having client meetings at cafes. It was and still can be sufficient for the work I do, but a few perks of a private space excites me to give it a try. The first and biggest perk is as the name suggests "private" space, it's very important to me that I have my own dedicated space to work out of, when you're working from home there's only so much room you can spare from the clutter of household things. Best of all, there's an infinite number of possibilities when you're starting fresh, this appeals to me a lot. Will be able to experiment with a lot of things and see what fits the space.&lt;/p&gt;

&lt;p&gt;I don't see new clients walk in with a requirement for my services, this is not how I work (I need to know the person to start any work) and I don't expect this to happen but it'll be fun to experience it when something like this happens. This won't be my first office nor the last, but I am feeling very positive and eager to see how things go.&lt;/p&gt;

&lt;p&gt;I want to use this new place as my workspace, hangout area, to meet clients, for creative activities, to hold small meetups and to organize movie nights. I can hear you say, enough already.&lt;/p&gt;

&lt;p&gt;I am very excited to see what this new change will have for my life and Simplest Web's future. I will be sharing more updates with you in the future.&lt;/p&gt;

&lt;p&gt;Thanks to everyone that made this possible, I can't thank &lt;a href="https://g.page/tamilmaruthuvamgobi"&gt;Saravanan Doctor&lt;/a&gt; enough, who arranged everything from the start to end.&lt;/p&gt;

</description>
      <category>freelance</category>
      <category>dev</category>
      <category>work</category>
    </item>
    <item>
      <title>2019 in Numbers</title>
      <dc:creator>Adi Sk</dc:creator>
      <pubDate>Wed, 01 Jan 2020 05:24:55 +0000</pubDate>
      <link>https://forem.com/adi/2019-in-numbers-1k35</link>
      <guid>https://forem.com/adi/2019-in-numbers-1k35</guid>
      <description>&lt;p&gt;Hi All, I am back with a different kind of recap of last year (2019). I recently published a &lt;a href="https://simplestweb.in/blog/a-recap-of-2019?utm_campaign=post-2019numbers"&gt;lengthy recap&lt;/a&gt; of how my year was, then I had this idea to summaries the year in a bunch of numbers. These are the stats that mean something to me and are ones I would like to compare to sometime in the future.&lt;/p&gt;

&lt;p&gt;Call this self-obsession, math nerdy, number porn or whatever, my analytical brain sees the world in numbers and these are the number that summarizes how I have done in 2019, I think.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_pRGgjRt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/Rvq6QDT.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_pRGgjRt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/Rvq6QDT.png" alt="2019 in Numbers"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Some of these numbers even shocked me, so let me know which one of these surprised you the most in the comment box. It was great fun putting this together, hope my future self is able to do better 😋.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Thank you for reading.&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;That’s all for now, this has been Adi.&lt;br&gt;&lt;br&gt;
If you are looking for a Freelance Web Developer you can &lt;a href="https://simplestweb.in/contact-me?utm_campaign=post-2019numbers"&gt;contact me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>freelance</category>
      <category>2019</category>
      <category>recap</category>
    </item>
    <item>
      <title>A recap of 2019</title>
      <dc:creator>Adi Sk</dc:creator>
      <pubDate>Thu, 19 Dec 2019 11:24:48 +0000</pubDate>
      <link>https://forem.com/adi/a-recap-of-2019-3hao</link>
      <guid>https://forem.com/adi/a-recap-of-2019-3hao</guid>
      <description>&lt;p&gt;Hi all, this I Adi. 2019 has been a wonderful year for me, so I just wanted to take a moment to reflect and document what's changed for me since 2018. In this post, I wanted to talk about how various aspect of my life has seen a change and also note some goals for the upcoming year. &lt;/p&gt;

&lt;h3&gt;
  
  
  Freelancing
&lt;/h3&gt;

&lt;p&gt;This year, I have had the chance to meet a lot of new people, of who a few of them turned into my clients. I’ve worked on 7 new projects and are in talks with a bunch more. I finally have gotten around to printing my business card, I would have never known that a simple thing like a business card could take one's professionalism a little higher, I would suggest you have one even if you’re just starting out, it will make a difference.&lt;/p&gt;

&lt;p&gt;I did have a few bitter experiences when I had to drop 2 projects. 1 was due to a client not cooperating well and the other because, I worked on this project for 3 months straight and was exhausted after a point, so I had to hand it over to another developer to maintain my sanity. At the end of the day, we are all just humans, when you see an issue looming at a distance, you should talk this over with your clients, you’ll be surprised to know how many of them offer their support, especially when you’re a freelancer.&lt;/p&gt;

&lt;p&gt;All in all, I have enjoyed working on all of these projects. I worked on the largest project for me yet, it was for &lt;a href="https://uzhavarbumi.com/"&gt;Uzhavarbumi&lt;/a&gt;, I was responsible for their 2 apps, the API, the admin portal, their website, and their business intelligence setup. Fortunately, I had the necessary assets, time and most of all, the support of a best friend (You are AWESOME &lt;a href="https://mercywrites.in"&gt;Mercy&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;You can know more about my recent &lt;a href="https://simplestweb.in/projects"&gt;projects here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Side Projects
&lt;/h3&gt;

&lt;p&gt;Some of you might know that last year, around the same time, I launched my side project &lt;a href="https://laravelcollections.com"&gt;Laravel Collections&lt;/a&gt;. I worked on it till April and got thousands of visitors every month. This was taking up a lot of my time from work, so I decided to sell it and the people who acquired it have great plans for it in the future.&lt;/p&gt;

&lt;p&gt;Since then I have been concentrating on my freelance projects, no time for side projects. I do have a few ideas that I want to explore to see what works. I have planned to work on them in 2020. So, stay tuned for those updates.&lt;/p&gt;

&lt;h3&gt;
  
  
  Personal Life
&lt;/h3&gt;

&lt;p&gt;This year, I have made time for a lot of travel. I have made it a routine for me to retreat to someplace every other week, this has been very helpful, time away from a monitor screen is the best way I have found to recharge myself.&lt;/p&gt;

&lt;p&gt;I started reading 7 books but could only complete 3 from cover to cover. I need to work on this habit.&lt;/p&gt;

&lt;p&gt;It was one of my goals from last year, to watch one film a day, at least an average of one film a day. With the help of 4 streaming services, I have been able to cross my expectations and watch 372 films so far this year, add a bunch more by the year-end.&lt;/p&gt;

&lt;p&gt;I have also kept myself busy by taking up a few hobbies origami and chess. I try to make at least one origami craft every day and also practice chess daily, though I don't have time for a full game, I try all the daily puzzles on &lt;a href="http://Chess.com"&gt;Chess.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have been writing blog posts more frequently these days. I have been publishing at least one post a month. Writing mostly about Laravel related stuff.&lt;/p&gt;

&lt;p&gt;Best of all, I have spent a lot of time catching up with a lot of my old friends and some new ones. Especially 2 of whom I spend a lot of time with. Personal life's been generally positive and a lot more fulfilling and meaningful because of the newfound friendships.&lt;/p&gt;

&lt;h3&gt;
  
  
  Goals for 2020
&lt;/h3&gt;

&lt;p&gt;I have a few goals for myself for the next year. I would not call them goals, more like things I want to do.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Find time to work on a Laravel side project (will be announced soon)&lt;/li&gt;
&lt;li&gt;Launch a digital product, I have a few ideas will be testing later next year&lt;/li&gt;
&lt;li&gt;Watch a film every day, this is quite possible since I have done it this year&lt;/li&gt;
&lt;li&gt;Organize a meetup for developers from my locale&lt;/li&gt;
&lt;li&gt;More travel&lt;/li&gt;
&lt;li&gt;Move time with friends&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;This is an overview of how I been over the last year. It’s been a pleasant ride, hoping for the same next year around.&lt;/p&gt;

&lt;p&gt;Let me know how your year was, will be glad to hear it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Thank you for reading.&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;That’s all for now, this has been Adi.&lt;br&gt;&lt;br&gt;
If you are looking for a Freelance Web Developer you can &lt;a href="https://simplestweb.in/contact-me?utm_campaign=LaravelActionsTutorial"&gt;contact me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>freelance</category>
      <category>recap</category>
    </item>
    <item>
      <title>How to setup Tailwind CSS with Parcel Bundler</title>
      <dc:creator>Adi Sk</dc:creator>
      <pubDate>Tue, 26 Nov 2019 15:17:59 +0000</pubDate>
      <link>https://forem.com/adi/how-to-setup-tailwind-css-with-parcel-bundler-1cj4</link>
      <guid>https://forem.com/adi/how-to-setup-tailwind-css-with-parcel-bundler-1cj4</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;Hi all, this is Adi. Today, I wanted to share with you my experience of how I set up Tailwind CSS with Parcel Bundler, if this interests you continue reading.&lt;/p&gt;

&lt;p&gt;I am a long time fan of Bootstrap since version 2, I have used it on nearly all my projects. Bootstrap 4 introduced many new utility classes that have made my life a little easier and my markup more readable. But lately, I have been hearing so much about the brand new CSS framework named &lt;a href="https://tailwindcss.com/"&gt;Tailwind CSS&lt;/a&gt;. I am quite confident that you might have heard about it as well. So I decided to give it a try, I read through their documentation and it was as though it was made for me (this framework is so generic, it will feel the same for anyone 😂).&lt;/p&gt;

&lt;p&gt;First I tried it with the hosted version of the framework, it has so much flexibility. Now I wanted to take it a set further and see how I could set it up in my development flow. This is where things proved tricky. Their documentation had instructions for Webpack, Gulp, Laravel Mix and a bunch of other JS tools but not for the one I use &lt;a href="https://parceljs.org/"&gt;Parcel Bundler&lt;/a&gt;. It took me a while before I could get Tailwind to work with my existing Parcel setup.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://gist.github.com/skadimoolam/48d79be428cb6b479a741b3575fb74f3"&gt;Source Code Here&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  My Setup
&lt;/h3&gt;

&lt;p&gt;First, let's add the new dev dependencies to your &lt;code&gt;package.json&lt;/code&gt; file, you need &lt;code&gt;parcel-bundler&lt;/code&gt;, &lt;code&gt;postcss-modules&lt;/code&gt; and &lt;code&gt;tailwindcss&lt;/code&gt;. Postcss is a css per-processor which Tailwind is built with.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AEefUTcF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/dcywc75.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AEefUTcF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/dcywc75.png" alt="Step 1"&gt;&lt;/a&gt;&lt;br&gt;
Next, create &lt;code&gt;postcss.config.js&lt;/code&gt; in your project root file. This is the configuration for Postcss module, this will be used by Parcel during build. Also, if the NODE_ENV is set to production, we use &lt;code&gt;purgecss&lt;/code&gt; module to compress and just have the classes we use in our markup, this process drastically reduces the final css file. This config is enough for us to get started. If you want to customize Tailwind refer to &lt;a href="https://tailwindcss.com/docs/configuration"&gt;this page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dj97d9w9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/Y9fP32u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dj97d9w9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/Y9fP32u.png" alt="Step 2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Usage in Markup
&lt;/h3&gt;

&lt;p&gt;In our html markup file, let's include css file. You'll notice that extension is &lt;code&gt;.pcss&lt;/code&gt; this indicates Parcel Bundler to process that file with Postcss module. This file extension will be renamed to &lt;code&gt;.css&lt;/code&gt; during the build process.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SYN9nLoq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/CCnIAyt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SYN9nLoq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/CCnIAyt.png" alt="Step 3"&gt;&lt;/a&gt;&lt;br&gt;
In your &lt;code&gt;app.pcss&lt;/code&gt; file include these three lines, this will include Tailwinds css classes, you can write normal css below these lines, that will also be included in the build output.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GzWXxbSk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/0V1zmeU.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GzWXxbSk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/0V1zmeU.png" alt="Step 4"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Tailwind has been growing on me, I am just getting used to its paradigm but I can see myself use it on my future work. That's about it, if you face any issues with this configuration, please comment, I will try to help.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;That’s all for now, this has been Adi.&lt;br&gt;&lt;br&gt;
If you need a Freelance Developer with Laravel knowledge you can &lt;a href="https://simplestweb.in/contact-me?utm_campaign=LaravelActionsTutorial"&gt;contact me&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Thanks for reading.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>tutorial</category>
      <category>tailwindcss</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Reusing a Controller method for multiple actions in Laravel</title>
      <dc:creator>Adi Sk</dc:creator>
      <pubDate>Wed, 30 Oct 2019 11:51:32 +0000</pubDate>
      <link>https://forem.com/adi/reusing-a-controller-method-for-multiple-actions-in-laravel-4ab2</link>
      <guid>https://forem.com/adi/reusing-a-controller-method-for-multiple-actions-in-laravel-4ab2</guid>
      <description>&lt;p&gt;Hi All, this is Adi with another Laravel tutorial. This time, I wanted to cover my basic solution to a problem we might all have when building web apps using only blade templates.&lt;/p&gt;

&lt;p&gt;Let's take this example scenario and explore possible solutions. We have an &lt;code&gt;index&lt;/code&gt; method on let's say &lt;code&gt;UsersController&lt;/code&gt; which lists all the users from our database. Each &lt;code&gt;user&lt;/code&gt; has a &lt;code&gt;Subscription&lt;/code&gt; and we want to change their subscription. How would you go about doing this with pure blade templates? There are multiple solutions to this, one would be to show a different page where we can select a plan from a dropdown and it gets submitted. Another solution would be to have a User's details page, where we can change the subscription and that gets submitted. But I want to show you how I do it, I open a modal in the index page where all users are listed, we choose the subscription and the form gets submitted, all from the same page. This is just one example, but if you use this method well, you would be able to add, edit, confirm, show other messages all on the same page, kind of like a SPA but each page gets loaded from the server.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://gist.github.com/skadimoolam/ee086960024bfb1ad643446e84fcab97"&gt;Source Code Here&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  TLDR;
&lt;/h3&gt;

&lt;p&gt;First, let me explain how my solution works. This solution works by changing the URL parameters of the &lt;code&gt;index&lt;/code&gt; method of the &lt;code&gt;UsersController&lt;/code&gt; in our example case.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;/users&lt;/code&gt; - This page lists all users&lt;br&gt;
&lt;code&gt;/users?edit=12&lt;/code&gt; - The same index page will display a model to edit the details of the user with id 12&lt;br&gt;
&lt;code&gt;/users?delete=12&lt;/code&gt; - This displays a confirmation modal on the same index page.&lt;br&gt;
As you can see this solution can be expanded to do many more actions.&lt;/p&gt;

&lt;p&gt;In our controller, we identify which action is being requested using the url parameter and send the response accordingly. Also, in the view, we display a model if a certain variable is sent to the view.&lt;/p&gt;

&lt;p&gt;Let's see some code, you will understand it better.&lt;/p&gt;

&lt;h3&gt;
  
  
  Controller
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zStFyuYu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/u1B9cJi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zStFyuYu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/u1B9cJi.png" alt="Controller Logic"&gt;&lt;/a&gt;&lt;br&gt;
As you see we have an empty variable &lt;code&gt;$edit&lt;/code&gt;  this will be populated if there's an &lt;code&gt;edit&lt;/code&gt; parameter in the request URL. This variable will be sent to view whether it has value or not.&lt;/p&gt;

&lt;p&gt;Simple Logic, ah.&lt;/p&gt;

&lt;h3&gt;
  
  
  View
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--E9Ap3KSf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/voOUNBn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--E9Ap3KSf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/voOUNBn.png" alt="View Logic"&gt;&lt;/a&gt;&lt;br&gt;
Now in the view, we include the model template only if the &lt;code&gt;$edit&lt;/code&gt; is set and not when it's empty. Also when you loop through the users to show them in a table or somewhere, use this helper &lt;code&gt;route('users.index', ['edit' =&amp;gt; $edit-&amp;gt;id])&lt;/code&gt; to add &lt;code&gt;?edit=&lt;/code&gt; to the request URL.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OhytkUv6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/VFtoU6w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OhytkUv6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/VFtoU6w.png" alt="Modal logic"&gt;&lt;/a&gt;&lt;br&gt;
Now for the final part of the view, we need the markup for our model and the JavaScript logic to show it when the page is loaded. The above markup is a pretty basic Bootstrap modal and a way to show it when the page is loaded.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;I hope this trick helps you in some way. You can extend on this tutorial to add as many actions you need. I am aware that this is a rudimentary way to implement such features. A better more stable way to implement them would be to build such complicated apps as a Single Page Applications (SPA).&lt;/p&gt;

&lt;p&gt;If you see any improvements, do let me know.&lt;br&gt;
If you have any comments or questions, leave them below.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;That's all for now, this has been Adi.&lt;br&gt;
If you need a Freelance Developer with Laravel knowledge you can &lt;a href="https://simplestweb.in/contact-me?utm_campaign=LaravelActionsTutorial"&gt;contact me&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Thank You&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>php</category>
      <category>tutorial</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How to setup automatic db backup in Laravel</title>
      <dc:creator>Adi Sk</dc:creator>
      <pubDate>Mon, 30 Sep 2019 05:26:00 +0000</pubDate>
      <link>https://forem.com/adi/how-to-setup-automatic-db-backup-in-laravel-16ck</link>
      <guid>https://forem.com/adi/how-to-setup-automatic-db-backup-in-laravel-16ck</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;Hi All, this is Adi again with a Laravel related article. This time in a shorter format. As Laravel developers we need a way to back up our app’s databases somewhere for both save keeping the data and for analysis. I want to share with you a simple solution that I have devised for some of my smaller projects. I have tested this method only on MySql DB and on a VPS, but I think it’s pretty much the same for any database.&lt;/p&gt;

&lt;h3&gt;
  
  
  TLDR;
&lt;/h3&gt;

&lt;p&gt;The outline of my solution is as follows. There’s an artisan command which handles the backup, that runs periodically using a cron. This command makes use of the &lt;code&gt;mysqldump&lt;/code&gt; tool that comes with all MySql installations. &lt;code&gt;mysqldump&lt;/code&gt; dumps the given DB into a &lt;code&gt;.sql&lt;/code&gt; and we can control where it is dumped. And that’s how my solution works. Now let's see some code.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Code
&lt;/h3&gt;

&lt;p&gt;First off create an Artisan command like so &lt;code&gt;php artisan make:command BackupDatabase&lt;/code&gt;. This should create a class with the name you mentioned in the command and should also have some default scaffolding for the command.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--o0PbhhP5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/BvZlkY7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--o0PbhhP5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/BvZlkY7.png" alt="DB Backup command"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let me explain what the above code does. Within the constructor we prepare the name of the file (line 20), then we check if there's a folder named &lt;code&gt;backups&lt;/code&gt; within the storage folder, if not we create it (line 21). Then we instantiate a process, with the command that we want to be executed, we also pass it other details (line 23-29).&lt;/p&gt;

&lt;p&gt;Then in the handle method runs the process and logs the output to the application logs. This handle method is executed after the constructor by Laravel itself, so you don't have to invoke it from anywhere.&lt;/p&gt;

&lt;p&gt;And finally you need to setup cron, you have 2 options here, either you can call Laravel's &lt;code&gt;schedule:run&lt;/code&gt; command or call your backup command directly.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;This is a pretty simple and neat solution for backing up your most valuable asset, that's the data. You can extend this feature to do more, like attach the .sql file to an email or upload it to dropbox or where ever and so on.&lt;/p&gt;

&lt;p&gt;That's all from me, it's been Adi - more about me at &lt;a href="https://simplestweb.in/?utm_campaign=laravel-backup-article"&gt;Simplest Web&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Related resources&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://laravel.com/docs/5.8/artisan"&gt;https://laravel.com/docs/5.8/artisan&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://laravel.com/docs/5.8/scheduling"&gt;https://laravel.com/docs/5.8/scheduling&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>php</category>
      <category>laravel</category>
      <category>tutorial</category>
      <category>database</category>
    </item>
    <item>
      <title>5 Minute Solution for Viewing Logs in a Laravel App</title>
      <dc:creator>Adi Sk</dc:creator>
      <pubDate>Thu, 29 Aug 2019 15:43:48 +0000</pubDate>
      <link>https://forem.com/adi/5-minute-solution-for-viewing-logs-in-a-laravel-app-24b6</link>
      <guid>https://forem.com/adi/5-minute-solution-for-viewing-logs-in-a-laravel-app-24b6</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;Hi All, it’s been a few months since my last Laravel related post. So I decided to write something small to get back into the schedule. I plan to publish something every month or even more frequently.&lt;/p&gt;

&lt;p&gt;We have all been there, your Laravel app isn't working as expected and you want to get to logs as fast as possible. In most situations we may not have easy access to the log files because we need an ssh client to connect to the server, then navigate to the logs and finally view the last entry in there. It's always a pain in the neck to do this. In this post, I want to show you my simple solution to viewing logs from within the app. I implemented this on a recent client project and it works quite well.&lt;/p&gt;

&lt;p&gt;As always, if you have a better implementation, please share, I would love to know about it.&lt;/p&gt;

&lt;h3&gt;
  
  
  TLDR;
&lt;/h3&gt;

&lt;p&gt;Here’s the overview of my solution. I have a route to a page, who’s controller reads that day’s log file and sends to the view. The view has 2 parts to it, first, it has a form to change the date of the currently viewed file and secondly the part where the logs are shown.&lt;/p&gt;

&lt;p&gt;Pretty simple aye. If it was not clear enough, check the code from below.&lt;/p&gt;

&lt;h3&gt;
  
  
  Code
&lt;/h3&gt;

&lt;p&gt;First off, add a route where you want to display the log file entries&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TzLgWgnj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/hZ22Hcy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TzLgWgnj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/hZ22Hcy.png" alt="Route file content"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then comes the controller, below is the logic for the controller. Here we get the date for when we need the logs for. Then we extract information about the file and it's contents and send it to the view.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ESKrFc_3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/TDQp1QZ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ESKrFc_3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/TDQp1QZ.png" alt="Controller file contents"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here in the view, we have 2 parts, one to change the date of the Log file and the other is to view the actual Log file's contents.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--B-GGAFpP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/AgfUdSi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--B-GGAFpP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/AgfUdSi.png" alt="View file contents"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you put everything together, you will have your own Log Viewer. The image below is what I have after adding some CSS. Not bad for like 5 minutes of work, ah.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_cy2mvLU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/UhphURe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_cy2mvLU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/UhphURe.png" alt="Final result"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;I hope this solution is of some use to you. If you have a better solution to do the same, do let them know. I am more than glad to try it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Related resources&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://laravel.com/docs/6.0/errors"&gt;https://laravel.com/docs/6.0/errors&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/rap2hpoutre/laravel-log-viewer"&gt;https://github.com/rap2hpoutre/laravel-log-viewer&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/ARCANEDEV/LogViewer"&gt;https://github.com/ARCANEDEV/LogViewer&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's all for now. Talk to you in the next one.&lt;br&gt;
More about me at &lt;a href="https://simplestweb.in/?utm_campaign=LCJobs-launch-article"&gt;SimplestWeb.in&lt;/a&gt;&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>php</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Launching Jobs by LaravelCollections.com</title>
      <dc:creator>Adi Sk</dc:creator>
      <pubDate>Thu, 09 May 2019 05:59:11 +0000</pubDate>
      <link>https://forem.com/adi/launching-jobs-by-laravelcollections-com-1oci</link>
      <guid>https://forem.com/adi/launching-jobs-by-laravelcollections-com-1oci</guid>
      <description>&lt;p&gt;Hi All. I wanted to show you a service I have been working on for the past few weeks. As you may already know, I have a side project (&lt;a href="https://laravelcollections.com/?utm_campaign=LCJobs-launch-article"&gt;LaravelCollections.com&lt;/a&gt;), a lot of users requested a Job Board and that's what I have been working on.&lt;/p&gt;

&lt;p&gt;A Job Board for Laravel / PHP / Vue developers, I am calling it '&lt;a href="https://laravelcollections.com/jobs?utm_campaign=LCJobs-launch-article"&gt;Jobs by LaravelCollections.com&lt;/a&gt;'. This Job Board is intended to help great developers find work, as well as small firms and individuals to find the best developer for their openings. Let me explain in detail.&lt;/p&gt;

&lt;h3&gt;
  
  
  How did it happen
&lt;/h3&gt;

&lt;p&gt;This side project got a bit of traction from the start of this year. Since then people have been requesting for a Job Board, initially, I did not have a valid enough reason to work on a Job Board. After a few more requests, I realized how many great developers have a hard time finding full-time or freelance work, I felt I can help.&lt;/p&gt;

&lt;p&gt;At first, I thought to partner with LaraJobs to show their listings on the site but for reasons I still don't understand, this did not work in my favor. So I decided to build a job board from scratch. I spoke with a few friends in the industry to find what they might be willing to pay for a Job Listing that reaches 100s of developers. Once I knew that people are willing to pay for it and how much they would pay, I started work on actually building the job board, this was probably the easiest part for me.&lt;/p&gt;

&lt;p&gt;The Job board started taking shape quickly and now I had to find employers. I did not want to launch a Job Board without any jobs so I reached out to a few agencies and I made an offer they could not refuse. I offered a free listing with all the paid features, who would say no. After 15 or so emails, I had my first 5 "free" customers.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Launch
&lt;/h3&gt;

&lt;p&gt;After weeks of work and preparations, I decided to launch it yesterday that is May 8th. I first announced it on the social media pages for the site, then on HackerNews, Reddit, IndieHackers, and DesignerNews. This got me the first few 100 users. Overall the launch went great, lots of new users, quite a bit of experience along the way.&lt;/p&gt;

&lt;h3&gt;
  
  
  A word for Employers
&lt;/h3&gt;

&lt;p&gt;If you are interested in posting your Laravel / PHP / Vue opening, it's quite simple, just fill in &lt;a href="https://laravelcollections.com/jobs/new?utm_campaign=LCJobs-launch-article"&gt;this form&lt;/a&gt;. Each listing costs $29 and your job opening is shown to 100s of developers on our site, plus.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Shown at the top of our Board.&lt;/li&gt;
&lt;li&gt;Shown at the bottom of all pages for a week.&lt;/li&gt;
&lt;li&gt;Featured to our weekly newsletter.&lt;/li&gt;
&lt;li&gt;Sent out to our notification Subscribers.&lt;/li&gt;
&lt;li&gt;Posted on our social media pages.&lt;/li&gt;
&lt;li&gt;Shared to similar groups on Facebook&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Not bad for $29 ah.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;These last few weeks have been greatly experiential for me. I learned the process that's involved in building and launching a product or service, like where to find potential customers, how to price it, how to promote it and how to handle sales.&lt;/p&gt;

&lt;p&gt;I am hoping to improve this Job Board whenever I get time, if you have any suggestions or feedback, let them known.&lt;/p&gt;

&lt;p&gt;That's all for now. Bye.&lt;br&gt;
More about me at &lt;a href="https://simplestweb.in/?utm_campaign=LCJobs-launch-article"&gt;SimplestWeb.in&lt;/a&gt;&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>php</category>
      <category>hiring</category>
      <category>career</category>
    </item>
  </channel>
</rss>
