<?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: PostSrc</title>
    <description>The latest articles on DEV Community by PostSrc (@postsrc).</description>
    <link>https://dev.to/postsrc</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%2F39015%2F6b224df9-20c3-4764-95b9-f0b4564c8749.jpg</url>
      <title>DEV Community: PostSrc</title>
      <link>https://dev.to/postsrc</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/postsrc"/>
    <language>en</language>
    <item>
      <title>Top 3 stock images source for developers and designers</title>
      <dc:creator>PostSrc</dc:creator>
      <pubDate>Mon, 15 Nov 2021 04:00:00 +0000</pubDate>
      <link>https://dev.to/postsrc/top-3-stock-images-source-for-developers-and-designers-2beb</link>
      <guid>https://dev.to/postsrc/top-3-stock-images-source-for-developers-and-designers-2beb</guid>
      <description>&lt;p&gt;Stock Images is very important and it's used for many things from Designing, Web user interface assets, and many others. Below are the top 3 places where you can get these stock images for free and in high definition. You can use it in most of your projects for free with an exception which is to include and add credit when using the image.&lt;/p&gt;

&lt;p&gt;The list below goes from the most popular one but regardless of that, all of them have many high-quality photos.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://postsrc.com/"&gt;This post was originally published at PostSrc 🔥🔥🔥&lt;/a&gt;. If you like this kind of tutorial, I would really appreciate it if you give it a visit.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postsrc.com/storage/jo6ZSyTER7BHNIgAdVmckIkXam2lB8IEu9wG2l9y.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2BJChEEd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://postsrc.com/storage/jo6ZSyTER7BHNIgAdVmckIkXam2lB8IEu9wG2l9y.png" alt="Unsplash Homepage" width="880" height="618"&gt;Unsplash Homepage&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://unsplash.com"&gt;&lt;strong&gt;Unsplash&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Unsplash has been around for some years and it's by far the largest collection of free stock images that's available on the internet. You can search almost anything or search it by category. It's also very convenient that they allow us to manipulate the image before downloading which means the image can be optimized before even downloading it.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://postsrc.com/storage/gnUZ7jPGJxNwjrUny60WOlWfP9CETgCfj9rATAGz.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LfKVE0X5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://postsrc.com/storage/gnUZ7jPGJxNwjrUny60WOlWfP9CETgCfj9rATAGz.png" alt="Pexels Homepage" width="880" height="618"&gt;Pexels Homepage&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.pexels.com"&gt;&lt;strong&gt;Pexels&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The second on the list is Pexels, Which also provides many free stock images like Unsplash but it's just another platform. One thing that Pexels has is advanced image filtering and one of them is filter by color.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://postsrc.com/storage/5B5U8oILkdinSIcE8eZtzFq59NaVaB3XIqoiBt8U.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ON2YK6uD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://postsrc.com/storage/5B5U8oILkdinSIcE8eZtzFq59NaVaB3XIqoiBt8U.png" alt="Pixabay Homepage" width="880" height="618"&gt;Pixabay Homepage&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://pixabay.com"&gt;&lt;strong&gt;Pixabay&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The last on the list is Pixabay and this is pretty much like Unsplash and Pexels. They have more than 1.8 million high-quality stock images.&lt;/p&gt;

&lt;p&gt;Do mix and match these sources and make sure to credit the image to their owner if you are using it. Do let us know which other stock images collection in the comment below.&lt;/p&gt;

</description>
      <category>stockimage</category>
      <category>imageresource</category>
      <category>unsplash</category>
    </item>
    <item>
      <title>How to set up CodeMirror for Laravel project</title>
      <dc:creator>PostSrc</dc:creator>
      <pubDate>Thu, 28 Oct 2021 02:00:00 +0000</pubDate>
      <link>https://dev.to/postsrc/how-to-set-up-codemirror-for-laravel-project-2p6j</link>
      <guid>https://dev.to/postsrc/how-to-set-up-codemirror-for-laravel-project-2p6j</guid>
      <description>&lt;p&gt;&lt;a href="https://postsrc.com/" rel="noopener noreferrer"&gt;This post was originally published at PostSrc 🔥🔥🔥&lt;/a&gt;. If you like this kind of tutorial, I would really appreciate it if you give it a visit.&lt;/p&gt;

&lt;p&gt;In this post, you'll be learning to set up &lt;a href="https://codemirror.net/" rel="noopener noreferrer"&gt;CodeMirror&lt;/a&gt; for your Laravel project. CodeMirror is a very versatile text editor implemented in JavaScript for the browser but in this tutorial, we'll be using CodeMirror to display code example and beautify it by applying &lt;a href="https://codemirror.net/mode/index.html" rel="noopener noreferrer"&gt;language modes&lt;/a&gt; and &lt;a href="https://codemirror.net/doc/manual.html#styling" rel="noopener noreferrer"&gt;themes&lt;/a&gt;.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Let's get Started&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
First, install the dependency via "npm" or "yarn".&lt;/p&gt;

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

yarn add codemirror


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

&lt;/div&gt;

&lt;p&gt;Next, create a new js file and name it "code-mirror.js" inside the resource folder. This will be passed on to Laravel Mix for processing.&lt;/p&gt;

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

# laravel mix

const mix = require('laravel-mix');

mix.js('resources/js/code-mirror.js', 'public/js');


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

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Initialize CodeMirror Instance&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
The content of the "js/code-mirror.js" should be the import and initialization for CodeMirror. For this example, we'll be focusing on the PHP modes but if you plan to use it for other programming languages, do check out their other modes available on the documentation. &lt;/p&gt;

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

/* resources/js/code-mirror.js */

import CodeMirror from 'codemirror';
import 'codemirror/addon/edit/matchbrackets';
import 'codemirror/mode/javascript/javascript.js';
import 'codemirror/mode/htmlmixed/htmlmixed.js';
import 'codemirror/mode/xml/xml.js';
import 'codemirror/mode/css/css.js';
import 'codemirror/mode/clike/clike.js';
import 'codemirror/mode/php/php.js';

var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
    lineNumbers: true,
    theme: 'dracula',
    matchBrackets: true,
    mode: "application/x-httpd-php",
    indentUnit: 4,
    indentWithTabs: true,
    tabSize: 4,
    lineWrapping: true,
});



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

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Import CodeMirror Style and Theme&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
It's important that you import the styling to show the CodeMirror editor itself. From your "scss" or "css" file do import as follows. Do note that the theme imported is the "dracula" theme, if you want other themes do check out their docs for the full theme that is provided out of the box.&lt;/p&gt;

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

/* code mirror */
@import '~codemirror/lib/codemirror.css';
@import '~codemirror/theme/dracula.css';


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

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Reference the Script in Blade Layout&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Finally reference the script in the blade layout file of your project. Do note that the code source that you want to render can be from any of your Laravel models, for example, Code / Post / Article / Demo model instance. Pass the code instance into the textarea like below and make sure the id is set to "code" since we are using it to initialize the CodeMirror instance.&lt;/p&gt;

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

&amp;lt;textarea id="code"&amp;gt;{!! $model-&amp;gt;code !!}&amp;lt;/textarea&amp;gt;

&amp;lt;script src="{{ asset('/js/code-mirror.js') }}"&amp;gt;&amp;lt;/script&amp;gt;


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

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Preview CodeMirror&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Below is the preview of the CodeMirror editor on the browser and depending on the theme it will be displayed differently.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://postsrc.com/storage/8HqkIykN5oiUGhel4qylG7Y0ZkwcE1HyJsxVGVVK.png" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpostsrc.com%2Fstorage%2F8HqkIykN5oiUGhel4qylG7Y0ZkwcE1HyJsxVGVVK.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Extra: Using Highlight.Js&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
If you are interested in the other approach to highlight codes, you can have a look &lt;a href="https://postsrc.com/posts/using-highlight-js-on-laravel-project" rel="noopener noreferrer"&gt;&lt;em&gt;Using highlight.js on Laravel project&lt;/em&gt;&lt;/a&gt;.  &lt;/p&gt;

&lt;p&gt;By now you will have learned how to implement CodeMirror on your website in few simple steps. If you find this tutorial to be helpful do share it with others and cheers 🍻. happy coding!&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>laravelcodemirror</category>
      <category>laravelphp</category>
    </item>
    <item>
      <title>Cheapest and best VPS for value</title>
      <dc:creator>PostSrc</dc:creator>
      <pubDate>Thu, 21 Oct 2021 04:00:00 +0000</pubDate>
      <link>https://dev.to/postsrc/cheapest-and-best-vps-for-value-1ncd</link>
      <guid>https://dev.to/postsrc/cheapest-and-best-vps-for-value-1ncd</guid>
      <description>&lt;p&gt;&lt;a href="https://postsrc.com/"&gt;This post was originally published at PostSrc 🔥🔥🔥&lt;/a&gt;. If you like this kind of tutorial, I would really appreciate it if you give it a visit.&lt;/p&gt;

&lt;p&gt;Virtual Private Server aka VPS are getting cheaper and cheaper nowadays and many providers provide very competitive offerings&lt;/p&gt;

&lt;p&gt;&lt;a href="https://hetzner.cloud/?ref=VuQTJ1I4NrtS"&gt;&lt;strong&gt;Hetzner&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hetzner is one of our favorite hostings today and it values a lot for the money. We have used it for quite some time now and the performance that it delivers for its cost doesn't compare with other VPS providers.  &lt;/p&gt;

&lt;p&gt;For under less than 6 euro, we are getting specifications of 2 vCPU, 2GB of RAM, 40 GB of fast SSD storage, and 20TB of bandwidths which is insanely so much.  &lt;/p&gt;

&lt;p&gt;By far, this VPS provider has the best offering on the market and the value for the price is worth it. &lt;a href="https://hetzner.cloud/?ref=VuQTJ1I4NrtS"&gt;Claim Hetzner 30$ credit&lt;/a&gt;  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://postsrc.com/storage/46tzQHInhBOHUiuU343Cm1DJfuSW7t5FoPRBoaox.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dN5_gRp1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://postsrc.com/storage/46tzQHInhBOHUiuU343Cm1DJfuSW7t5FoPRBoaox.png" alt=""&gt;Hetzner Homepage&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.vultr.com/?ref=8375712-6G"&gt;&lt;strong&gt;Vultr&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The second VPS that we would recommend is Vultr and the value is on point. They have different specifications just like Hetzner but with more different specs and configurations that we can choose to.  &lt;/p&gt;

&lt;p&gt;They are very reliable and have more regions around the globe. &lt;a href="https://www.vultr.com/?ref=8375712-6G"&gt;Claim Vultr $100 Credit&lt;/a&gt;  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://postsrc.com/storage/Qc9mqcBcLIDqP3ZgtpZszVZM3wPO3huc846HskkN.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uRkt87-W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://postsrc.com/storage/Qc9mqcBcLIDqP3ZgtpZszVZM3wPO3huc846HskkN.png" alt=""&gt;Vultr Homepage&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Closing Note&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;These VPS are the ones that we both use and recommend.&lt;/p&gt;

</description>
      <category>cheapvps</category>
      <category>bestvps</category>
      <category>affordablevps</category>
    </item>
    <item>
      <title>How to add custom error pages with Nuxt Js</title>
      <dc:creator>PostSrc</dc:creator>
      <pubDate>Thu, 21 Oct 2021 04:00:00 +0000</pubDate>
      <link>https://dev.to/postsrc/how-to-add-custom-error-pages-with-nuxt-js-4o8p</link>
      <guid>https://dev.to/postsrc/how-to-add-custom-error-pages-with-nuxt-js-4o8p</guid>
      <description>&lt;p&gt;Error pages are very important to have and to add them to your Nuxt Js application, it's very straightforward and easy to implement. What we essentially need is an "error.vue" file inside the layouts folder and the code should be as follow.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Error template&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;template&amp;gt;
  &amp;lt;div&amp;gt;
    &amp;lt;h1 v-if="error.statusCode === 404"&amp;gt;Page not found&amp;lt;/h1&amp;gt;
    &amp;lt;h1 v-else-if="error.statusCode === 500"&amp;gt;Internal Server error&amp;lt;/h1&amp;gt;
    &amp;lt;h1 v-else&amp;gt;An error occurred&amp;lt;/h1&amp;gt;
    &amp;lt;NuxtLink to="/"&amp;gt;Home page&amp;lt;/NuxtLink&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/template&amp;gt;

&amp;lt;script&amp;gt;
  export default {
    props: ['error'],
    // layout: 'error' // you can set a custom layout for the error page
  }
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The code above should be named "error.vue" and this is a special template that Nuxt has set and it will accept a prop with error as its name. To know more of the available properties, do console log the error object or refer to this documentation of &lt;a href="https://nuxtjs.org/docs/2.x/internals-glossary/context#error"&gt;Nuxt Error Page section&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>nuxtjserrorpage</category>
      <category>customnuxterrorpage</category>
      <category>nuxtjs404</category>
    </item>
    <item>
      <title>Getting previous and next record in Laravel</title>
      <dc:creator>PostSrc</dc:creator>
      <pubDate>Sat, 28 Aug 2021 00:00:00 +0000</pubDate>
      <link>https://dev.to/postsrc/getting-previous-and-next-record-in-laravel-1mcl</link>
      <guid>https://dev.to/postsrc/getting-previous-and-next-record-in-laravel-1mcl</guid>
      <description>&lt;p&gt;&lt;a href="https://postsrc.com/" rel="noopener noreferrer"&gt;This post was originally published at PostSrc 🔥🔥🔥&lt;/a&gt;. If you like this kind of tutorial, I would really appreciate it if you give it a visit.&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%2Fw5nu5uuhk78060yjjyz1.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%2Fw5nu5uuhk78060yjjyz1.jpg" alt="Getting previous and next record in Laravel"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To be able to navigate around through the previous and next resources is a very handy feature to have. This will enable easy navigation between the record on both sides (left and right). The implementation is quite straight forward but certain logic has to be clearly defined to get the right result in the model.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Scenario&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PostSrc previous and next post&lt;/li&gt;
&lt;li&gt;Laracast previous and next episode series&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are several ways to implement this functionality and the simplest way is to use the Model Id. Since by right an Id auto increment, we can assume that the newest post will always have a higher number than the oldest post.   &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Previous and Next Implementation&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
To get the previous and next posts we'll be using the code below. Do note that it's within the controller that you have defined in, otherwise any other places suitable in your application.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;show&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nv"&gt;$id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// get the current post&lt;/span&gt;
    &lt;span class="nv"&gt;$post&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Post&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// get previous post id&lt;/span&gt;
    &lt;span class="nv"&gt;$previous&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Post&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;where&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'id'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'&amp;lt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$post&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'id'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// get next post id&lt;/span&gt;
    &lt;span class="nv"&gt;$next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Post&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;where&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'id'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'&amp;gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$post&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'id'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;view&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'posts.show'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;compact&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'post'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'previous'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'next'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the example above we are getting the default post by querying using the "id". To get the previous and next post we make use of the where clause by getting the lowest and highest post model "id" value. Once we get the models, we are comparing them with the other models we are getting the "max" for the previous post and "min" for the next post and this essentially filters the model to get only one that matches the criteria.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Previous and Next Video / Episode&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
In other case scenarios where you are not making use of the model "id", you need to define a column such as "episode_number" where it will store the numeric value.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;show&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nv"&gt;$id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// get the current episode&lt;/span&gt;
    &lt;span class="nv"&gt;$episode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Episode&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// get previous episode number&lt;/span&gt;
    &lt;span class="nv"&gt;$previous&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Episode&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;where&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'episode_number'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'&amp;lt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$post&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;episode_number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'episode_number'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// get next episode number&lt;/span&gt;
    &lt;span class="nv"&gt;$next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Episode&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;where&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'episode_number'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'&amp;gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$post&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;episode_number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'episode_number'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;view&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'episodes.show'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;compact&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'episode'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'previous'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'next'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>laravel</category>
      <category>laravelprevnext</category>
      <category>php</category>
    </item>
    <item>
      <title>How to implement a robots.txt file in a Nuxt Js project</title>
      <dc:creator>PostSrc</dc:creator>
      <pubDate>Thu, 26 Aug 2021 04:00:00 +0000</pubDate>
      <link>https://dev.to/postsrc/how-to-implement-a-robots-txt-file-in-a-nuxt-js-project-1ob4</link>
      <guid>https://dev.to/postsrc/how-to-implement-a-robots-txt-file-in-a-nuxt-js-project-1ob4</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--B8Z7CQ3P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wi0y02qgmg3w20p160fu.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--B8Z7CQ3P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wi0y02qgmg3w20p160fu.jpg" alt="How to implement a robots.txt file in a Nuxt Js project"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Having a robots.txt file is very important as it helps control Google and other search engines such as Bing to index website content. This is because the first thing crawler check when visiting the website is if robots.txt exists, hence it determine when content should be crawled or not.&lt;/p&gt;

&lt;p&gt;There are several ways to add robots.txt and it's as easy as writing down manually in the "statics" folder. But for this tutorial, we'll be using &lt;a href="https://github.com/nuxt-community/robots-module"&gt;&lt;strong&gt;nuxtjs/robots&lt;/strong&gt;&lt;/a&gt; as it's more flexible and the content of the robots.txt can be easily manipulated.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1 - Install nuxtjs/robots Package&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
First thing first, install the robots package and define it in the modules array of the nuxt.config.js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn add @nuxtjs/robots
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To define the robots config we can pass an object, array, or function where each method has its own use cases.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export default {
  modules: [
    '@nuxtjs/robots'
  ],
  robots: {
    /* module options */
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2 - Simple configuration&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
In this case, define the code as following and it will allow all user agents (bot) to crawl the site. In contrast, if the value of DIsallow is "/" then we are not allowing it to crawl any of the pages.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export default {
  robots: {
    UserAgent: '*',
    Disallow: ''
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Multiple user agents configuration&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
If you want to specify a configuration for a different user agent, do pass the array of objects as the robots value and it will behave as defined.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export default {
  robots: [
    {
      UserAgent: 'Googlebot',
      Disallow: '/user',
    },
    {
      UserAgent: '*',
      Disallow: '/admin',
    },
  ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Function configuration&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
You can also pass in a function as the robot's value and in this case define logic or conditionally define the value of the robot you want it to be.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export default {
  robots: () =&amp;gt; {
    if (someLogicHere) {
      return {
        UserAgent: '*',
        Disallow: '/'
      }
    }
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3 - yarn dev / npm run dev&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Finally, run "yarn dev" and now you can visit /robots.txt to see the value of the robots.txt that you have defined.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User-agent: Googlebot
Disallow: /users
User-agent: Bingbot
Disallow: /admin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://postsrc.com/"&gt;This post was originally published at PostSrc 🔥🔥🔥&lt;/a&gt;. If you like this kind of tutorial, I would really appreciate it if you give it a visit.&lt;/p&gt;

</description>
      <category>nuxt</category>
      <category>nuxtrobots</category>
      <category>nuxtcomment</category>
      <category>vue</category>
    </item>
    <item>
      <title>Nuxt Js Social Meta Tags for Social Sharing</title>
      <dc:creator>PostSrc</dc:creator>
      <pubDate>Mon, 26 Jul 2021 16:00:00 +0000</pubDate>
      <link>https://dev.to/postsrc/nuxt-js-social-meta-tags-for-social-sharing-jal</link>
      <guid>https://dev.to/postsrc/nuxt-js-social-meta-tags-for-social-sharing-jal</guid>
      <description>&lt;p&gt;In this post, you'll learn how to add social meta tags for better search engine optimization and social sharing. This will ensure that social networks such as Facebook and Twitter can get the appropriate data to show when contents are shared hence also improve the Google search engine result.  &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://github.com/AlekseyPleshkov/nuxt-social-meta"&gt;Nuxt Social Meta&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;By default, the easiest way to add the metadata is to use Nuxt Social Share which is a community package that has been around for a while. This package is great for simple use but not flexible enough to control the data.  &lt;/p&gt;

&lt;p&gt;To get started the package all we have to do is install it using npm or yarn.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn add nuxt-social-meta
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Include it in the modules config and define the property and value pairs representing your website details.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module.exports = {
  modules: [
    ...[
      "nuxt-social-meta",
      {
        url: "Site url",
        title: "Title",
        site_name: "Site name",
        description: "Site description",
        img: "Link to image in static folder",
        locale: "en_US",
        twitter: "@user",
        twitter_card: "summary_large_image",
        themeColor: "#theme-color",
      },
    ],
  ],
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you have defined that, now do run "yarn dev" and view the "head" section of the page. The necessary meta tags are generated by it. That's great but it lacks customization and flexibility to control and change the data. For the above example, all pages will have the same metadata which is not ideal for it's purpose.  &lt;/p&gt;

&lt;h2&gt;
  
  
  Custom Implementation Helper (Better Nuxt Social Meta)
&lt;/h2&gt;

&lt;p&gt;The solution that I have come up with is to &lt;a href="https://nuxtjs.org/docs/2.x/directory-structure/plugins/#inject-in-root--context"&gt;define a custom plugin&lt;/a&gt; that injects a simple function that will generate the head metadata and then call the function in the head meta property which is available on every page.  &lt;/p&gt;

&lt;p&gt;The first thing to do is to create the file of the plugin. Call it "social-meta.js" and in this file, you need to copy the following code as a boilerplate which you can fully customize with your heart content.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function socialMeta(options) {
    // All meta tags
    const metaTags = [
        // Global
        { name: "author", content: options.url },
        { name: "publisher", content: options.url },
        { name: "apple-mobile-web-app-title", content: options.title },
        { name: "theme-color", content: options.themeColor },

        // Facebook &amp;amp; LinkedIn
        { property: "og:title", content: options.title },
        { property: "og:description", content: options.description },
        { property: "og:type", content: "website" },
        { property: "og:url", content: options.url },
        { property: "og:image", content: options.img },
        { property: "og:image:alt", content: options.title + ' page cover' },
        { property: "og:locale", content: options.locale },
        { property: "og:site_name", content: options.site_name },

        // Twitter
        { name: "twitter:card", content: options.twitter_card },
        { name: "twitter:site", content: options.twitter },
        { name: "twitter:creator", content: options.twitter },
        { name: "twitter:title", content: options.title },
        { name: "twitter:description", content: options.description },
        { name: "twitter:image", content: options.img },
    ];

    // Add meta tags to head
    return metaTags.map((tag) =&amp;gt; {
        if (tag.content !== undefined &amp;amp;&amp;amp; tag.content !== null) {
            if (tag.hasOwnProperty("name")) {
                return {
                    hid: tag.name,
                    name: tag.name,
                    content: tag.content,
                }
            } else if(tag.hasOwnProperty("property")){
                return {
                    hid: tag.property,
                    property: tag.property,
                    content: tag.content,
                }
            }
        }
    })
}

export default ({ app }, inject) =&amp;gt; {
    inject('socialMeta', socialMeta)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What the code above does is that we'll define the required metadata in an array of key-value pairs which in turn create a collection of objects stored in an array of metadatas.  &lt;/p&gt;

&lt;h2&gt;
  
  
  Using the Helper
&lt;/h2&gt;

&lt;p&gt;Now make use of the helper in any page you want the social meta to appear. In this case let's say the homepage of your Nuxt Js site.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;head () {
    const description = 'Your website description here'

    return {
      title: 'Homepage',
      meta: [
        {
          hid: 'description',
          name: 'description',
          content: description
        },
        ...this.$socialMeta({
          url: "your-website.com",
          title: "Website Homepage",
          site_name: "Website",
          description: description,
          img: 'website-image.jpg',
          locale: "en",
          twitter: "@website-twitter-handle",
          twitter_card: "summary_large_image",
          themeColor: "#hex-color-theme",
        })
      ]
    }
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run yarn dev and head over to the page that contains this data. Do note that this is valid if defined on the layout page, any other pages that contain the same code will override the content of the layout head content.  &lt;/p&gt;

&lt;p&gt;By now you should be able to customize and add any of the necessary head metadata on your own. If you have any suggestions do comment down below. If you find it helpful do share it with your friends and keep on learning. cheers 🍻&lt;/p&gt;

&lt;p&gt;This post is originally published at &lt;a href="https://postsrc.com/"&gt;PostSrc&lt;/a&gt;. If you like this kind of tutorial, I would really appreciate it if you give it a visit.&lt;/p&gt;

</description>
      <category>nuxt</category>
      <category>nuxtsocialmeta</category>
      <category>vue</category>
    </item>
    <item>
      <title>How to Terminate Horizon during Deployment in Laravel Forge</title>
      <dc:creator>PostSrc</dc:creator>
      <pubDate>Mon, 26 Jul 2021 04:00:00 +0000</pubDate>
      <link>https://dev.to/postsrc/how-to-terminate-horizon-during-deployment-in-laravel-forge-5eal</link>
      <guid>https://dev.to/postsrc/how-to-terminate-horizon-during-deployment-in-laravel-forge-5eal</guid>
      <description>&lt;p&gt;&lt;a href="https://laravel.com/docs/master/horizon"&gt;&lt;strong&gt;Laravel Horizon&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Horizon is a beautiful dashboard for Laravel applications that make use of the Redis queue. In this short post, you'll learn how to terminate Horizon process on Laravel Forge deployment process.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hT33uAJ4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://laravel.com/img/docs/horizon-example.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hT33uAJ4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://laravel.com/img/docs/horizon-example.png" alt=""&gt;&lt;/a&gt;Laravel Horizon dashboard&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Deployment Scripts&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Inside the deployment script, do add the command below and on each deployment, it will gracefully terminate the master Horizon process on the machine. Any of the jobs that horizon is processing will be completed then horizon will exit.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// existing deployment scripts

// command to terminate laravel horizon
php artisan horizon:terminate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Do note that you'll have to set up horizon daemon by accessing the "daemons" page on the dashboard and defining the configuration. The command would be "php artisan horizon" and the directory is the full path of where the website is located in the machine.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://postsrc.com/storage/G2Cuc2CLeixPdtNeOtXSRUJFHQ7n3TVNQwzZDJ0m.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DSJtDPmk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://postsrc.com/storage/G2Cuc2CLeixPdtNeOtXSRUJFHQ7n3TVNQwzZDJ0m.png" alt=""&gt;Laravel Forge New Daemon&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By having a daemon, the horizon instance will automatically be restarted by the process monitor such as the supervisor upon each successful deployment.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://postsrc.com/storage/Edb8Xaz7auAIKG4GblYVmfeNCnuCQPCcLPVsntTc.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MAsWzsqS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://postsrc.com/storage/Edb8Xaz7auAIKG4GblYVmfeNCnuCQPCcLPVsntTc.png" alt=""&gt;Active Daemons in Laravel Forge&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope this tutorial is helpful and happy learning.&lt;/p&gt;

&lt;p&gt;This post is originally published at &lt;a href="https://postsrc.com/"&gt;PostSrc&lt;/a&gt;. If you like this kind of tutorial, I would really appreciate it if you give it a visit.&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>laravelhorizon</category>
      <category>laravelforge</category>
    </item>
    <item>
      <title>Installing PostgreSQL on MacOS</title>
      <dc:creator>PostSrc</dc:creator>
      <pubDate>Fri, 11 Jun 2021 12:00:00 +0000</pubDate>
      <link>https://dev.to/postsrc/installing-postgresql-on-macos-35c7</link>
      <guid>https://dev.to/postsrc/installing-postgresql-on-macos-35c7</guid>
      <description>&lt;p&gt;&lt;a href="https://postsrc.com/"&gt;This post was originally published at PostSrc 🔥🔥🔥&lt;/a&gt;. If you like this kind of tutorial, I would really appreciate it if you give it a visit.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bQA1tlmH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0wqzl89rphw3p3gl6k04.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bQA1tlmH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0wqzl89rphw3p3gl6k04.jpg" alt="Installing PostgreSQL on MacOS"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are several ways to install PostgreSQL on macOS and in this tutorial, you'll learn the easy way.    &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Installing PostgreSQL via DBngin&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
The first way is to install it using &lt;a href="https://dbngin.com/"&gt;DBngin&lt;/a&gt; and it's a free all-in-one database version management tool that comes with other databases as well such as MySQL and Redis. Under the hood, it's using &lt;a href="https://brew.sh/"&gt;Homebrew&lt;/a&gt; and the setup process is very simple. DBngin comes with a very simple GUI and anything from creating, starting, and stopping the database server can be done with a simple one-click button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postsrc.com/storage/TSPeD30BU1Aca7lsqs9M8pN56pdc63f4fBFgHjJR.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VT_ojIQK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://postsrc.com/storage/TSPeD30BU1Aca7lsqs9M8pN56pdc63f4fBFgHjJR.png" alt="DBngin Interface"&gt;DBngin Interface&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To create a new database simply press the + button and fill in the details required.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postsrc.com/storage/veZHoSnAPnhdbuC6HjRTV41JK9Svoi57pytPdgYw.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--l26FaB6_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://postsrc.com/storage/veZHoSnAPnhdbuC6HjRTV41JK9Svoi57pytPdgYw.png" alt="DBngin Create new Database"&gt;DBngin Create new Database&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What makes it special is the simple interface, simple database versioning, one press starting and stopping server and future updates right in one app.   &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Installing PostgreSQL via Homebrew&lt;/strong&gt; The second method is to use the &lt;a href="https://brew.sh/"&gt;Homebrew&lt;/a&gt; package manager. Let's get started and first launch your terminal and run the command below one by one.  &lt;/p&gt;

&lt;p&gt;Update brew to get the latest package version from the source.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Run brew doctor to run diagnosis to check if there are any errors.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Install the latest version of PostgreSQL.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Starting the PostgreSQL server.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew services start postgresql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you want to stop then run the stop command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew services stop postgresql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lastly, to view any running services run the services command.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Do note that the command above installs the latest version of the database, if you want other versions you have to specify the version number. For example, if you want to install version 12 run the command like below.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Installing PostgreSQL via Postgres.app&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
The 3rd method is to use &lt;a href="https://postgresapp.com/"&gt;Postgres.app&lt;/a&gt; and this application works just like DBngin but only has PostgreSQL database. It comes with a simple user interface and you can start, stop, restart, update and perform other actions with a click of a button. Do give it a look and if you are interested to try, just visit the homepage since it provides very straightforward installation guides.   &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Installing PostgreSQL via Package Installer&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
The last method is to install it using the &lt;a href="https://www.postgresql.org/download/"&gt;official package installer&lt;/a&gt; from PostgreSQL page. To get started just follow along with the installation wizard and you will have it installed in no time. It also comes with &lt;em&gt;pgAdmin&lt;/em&gt; which is a database management tool that is quite handy to use.   &lt;/p&gt;

&lt;p&gt;&lt;a href="https://postsrc.com/storage/bJTLBnZBqDWl2YcPEBlg5m7rF9thdVYIS9ajBNAj.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--s4pe84UY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://postsrc.com/storage/bJTLBnZBqDWl2YcPEBlg5m7rF9thdVYIS9ajBNAj.png" alt="Official PostgreSQL download page"&gt;Official PostgreSQL download page&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By now you should have PostgreSQL installed on your macOS and if you come across any issue do start a new discussion below. Thanks for reading and if you find it helpful do share it with your friends.&lt;/p&gt;

</description>
      <category>postgres</category>
      <category>installpostgres</category>
      <category>postgresmac</category>
    </item>
    <item>
      <title>New Programming Blog</title>
      <dc:creator>PostSrc</dc:creator>
      <pubDate>Mon, 07 Jun 2021 01:32:03 +0000</pubDate>
      <link>https://dev.to/postsrc/new-programming-blog-5c4</link>
      <guid>https://dev.to/postsrc/new-programming-blog-5c4</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0gOiko6W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5j5odb5obhudwtwv3yrq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0gOiko6W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5j5odb5obhudwtwv3yrq.png" alt="PostSrc Hompeage"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have been wanting to to have my own programming blog for a while now and since I have finally got the time, I have dedicated to spend it developing and maintining it. Please welcome &lt;a href="https://postsrc.com"&gt;PostSrc.com&lt;/a&gt; 😊.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postsrc.com/"&gt;PostSrc (Post Source)&lt;/a&gt; - a community of programmers sharing all things programming that includes a how-to tutorial, guides, and step by steps tutorial.&lt;/p&gt;

&lt;p&gt;You can learn web and mobile development, programming guides, and tutorials ranging from topics including VueJS, NuxtJs, Laravel Framework, TailwindCSS, Flutter, and More.&lt;/p&gt;

&lt;p&gt;If you have some free time do give it a visit and share it with your friends. #programming #blog #journey&lt;/p&gt;

</description>
      <category>blog</category>
      <category>programming</category>
      <category>laravel</category>
      <category>postsrc</category>
    </item>
    <item>
      <title>How to easily switch between PHP versions on macOS?</title>
      <dc:creator>PostSrc</dc:creator>
      <pubDate>Sun, 25 Oct 2020 04:00:00 +0000</pubDate>
      <link>https://dev.to/postsrc/how-to-easily-switch-between-php-versions-on-macos-46cp</link>
      <guid>https://dev.to/postsrc/how-to-easily-switch-between-php-versions-on-macos-46cp</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RNRXMSPB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zu8danbiysmrs9i9mso8.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RNRXMSPB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zu8danbiysmrs9i9mso8.jpg" alt="How to easily switch between PHP versions on macOS? Cover"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this post, we'll learn how to switch between PHP versions in the macOS system. Firstly I assume that PHP is installed using &lt;a href="https://brew.sh/"&gt;Homebrew&lt;/a&gt; and if you have not done so, do follow this tutorial on &lt;a href="https://postsrc.com/posts/how-to-install-php-8-on-macos-big-sur-using-homebrew"&gt;How to install PHP 8 on macOS Big Sur using Homebrew&lt;/a&gt;.  &lt;/p&gt;

&lt;h2&gt;
  
  
  Using Homebrew
&lt;/h2&gt;

&lt;p&gt;By right when using Homebrew, we can install multiple different versions of PHP at the same time but only use it one version at a time. To see which PHP version you have installed do run the command below and if you see it's ticked ✔︎ then it means it's installed.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;If none of the PHP is ticked then by default the PHP that's on the system is the default one shipped with macOS. Installing different versions is very important as many projects use a different version of PHP. In this case, let's assume that we have version 7.4 and 8.0.  &lt;/p&gt;

&lt;p&gt;By default PHP version on Homebrew is "&lt;a href="mailto:php@7.3"&gt;php@7.3&lt;/a&gt;", "&lt;a href="mailto:php@7.4"&gt;php@7.4&lt;/a&gt;" and "php" which means that the PHP that has no version number is the latest / highest version, in this current time of writing is version 8.0.  &lt;/p&gt;

&lt;h2&gt;
  
  
  Changing PHP Version
&lt;/h2&gt;

&lt;p&gt;To switch to the PHP version you can simply do run the command below. Switching from PHP version 7.4 to 7.3.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew unlink php@7.4
brew install php@7.3
brew link php@7.3
php -v
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Otherwise, if it's from PHP version 7.4 to 8.0 all you have to do is specify the version number.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew unlink php@7.4
brew link php
php -v
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Warning when switching
&lt;/h2&gt;

&lt;p&gt;Sometimes there will be a warning while switching mentioning that linking should use "force" and if that's the case do use the flag option.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew link php --force
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's all, by now you should be able to change to any PHP version that your project requires. One piece of advice is that it's better to have a project to always stay up to date so having maintained aka latest PHP version is always a good practice.&lt;/p&gt;

&lt;p&gt;This post is originally published at &lt;a href="https://postsrc.com/"&gt;PostSrc&lt;/a&gt;. If you like this kind of tutorial, I would really appreciate it if you give it a visit.&lt;/p&gt;

</description>
      <category>phpversion</category>
      <category>switchphpversion</category>
      <category>brewphp</category>
      <category>macosphp</category>
    </item>
    <item>
      <title>Deleting Laravel Redis Queue Jobs</title>
      <dc:creator>PostSrc</dc:creator>
      <pubDate>Thu, 30 Jul 2020 04:00:00 +0000</pubDate>
      <link>https://dev.to/postsrc/deleting-laravel-redis-queue-jobs-4p6g</link>
      <guid>https://dev.to/postsrc/deleting-laravel-redis-queue-jobs-4p6g</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--83aLusE_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wkrfwwhj9s3upil6pbb9.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--83aLusE_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wkrfwwhj9s3upil6pbb9.jpg" alt="Deleting Laravel Redis Queue Jobs"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are several ways to delete Laravel Redis queue jobs and below are the available options.  &lt;/p&gt;

&lt;h2&gt;
  
  
  Option 1 - Laravel Command
&lt;/h2&gt;

&lt;p&gt;The first way to clear a Redis queue is to use the artisan queue clear:command and this is the easiest you can do. Just open up the terminal and type the command below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php artisan queue:clear [connection] [queue]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command also works with other queue types such as a database.&lt;/p&gt;

&lt;h2&gt;
  
  
  Option 2 - Redis CLI
&lt;/h2&gt;

&lt;p&gt;The second way is to use the Redis command and you can access it by typing it below.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;once you are in Redis CLI, just run the command below.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;This will clear all of your Redis cached.&lt;/p&gt;

&lt;h2&gt;
  
  
  Option 3 - Laravel Facade
&lt;/h2&gt;

&lt;p&gt;Thirdly, If you want to use Laravel facade then you can create a &lt;strong&gt;route closure&lt;/strong&gt; or &lt;strong&gt;console command&lt;/strong&gt; to run the Redis command.&lt;br&gt;
&lt;/p&gt;

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

Redis::command('flushdb');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;BONUS:&lt;/strong&gt; If you want then you can make use of Laravel tinker.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;After that run the command the &lt;strong&gt;flushdb&lt;/strong&gt; command by passing it to the method parameters.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;\\Redis::command(‘flushdb’);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Above are some of the ways to clear out your Redis cache, there are other ways but those 3 ways above is the most common one and proven tested.  &lt;/p&gt;

&lt;p&gt;Thank you for reading the tutorial and I hope you managed to learn something. Do comment below to start the discussion of this topic. Cheers 🍻&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postsrc.com/"&gt;This post was originally published at PostSrc 👑 🚀&lt;/a&gt;. If you like this kind of tutorial, I would really appreciate it if you give it a visit.&lt;/p&gt;

</description>
      <category>laravelredis</category>
      <category>laravelclearqueue</category>
      <category>laravel</category>
      <category>php</category>
    </item>
  </channel>
</rss>
