<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Paul Nasilele on Medium]]></title>
        <description><![CDATA[Stories by Paul Nasilele on Medium]]></description>
        <link>https://medium.com/@paulnasilele?source=rss-93bfe6f45e07------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*fAmcI4p3jdeBDgL467AMGQ.jpeg</url>
            <title>Stories by Paul Nasilele on Medium</title>
            <link>https://medium.com/@paulnasilele?source=rss-93bfe6f45e07------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 06:15:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@paulnasilele/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Did You Know That You Can Rewrite Your Past?]]></title>
            <link>https://medium.com/know-thyself-heal-thyself/your-future-is-in-your-past-958f6a3ba7e3?source=rss-93bfe6f45e07------2</link>
            <guid isPermaLink="false">https://medium.com/p/958f6a3ba7e3</guid>
            <category><![CDATA[mindfulness]]></category>
            <category><![CDATA[know-thyself-heal-thyself]]></category>
            <category><![CDATA[self-awareness]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[future]]></category>
            <dc:creator><![CDATA[Paul Nasilele]]></dc:creator>
            <pubDate>Thu, 23 Sep 2021 18:44:31 GMT</pubDate>
            <atom:updated>2021-09-27T06:07:26.342Z</atom:updated>
            <content:encoded><![CDATA[<h4>A different perspective of your past may be all you need</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XGw8vYVzQdr7l7cI" /><figcaption>Photo by <a href="https://unsplash.com/@ravi_roshan_inc?utm_source=medium&amp;utm_medium=referral">Ravi Roshan</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>If you ask someone the question, “<em>What are you</em>?” Examples of answers you will get are as follows:</p><p><em>“Am an accountant.”</em></p><p><em>“Am a teacher who lives in New York.”</em></p><p><em>“Am an actor and I have been doing it for 15years.”</em></p><p><em>“Am a lawyer and I have four children.”</em></p><p><em>“Am a Footballer who plays in the English Premier League.”</em></p><p><em>“Am a reporter who works for CNN.”</em></p><p><em>“Am a father of two who also takes care of two orphaned children.”</em></p><p><em>“Am a medical student whose parents are from France.”</em></p><p>All these answers are pointing to what each individual did in the past. The truth is that we are defined by our past.</p><p>A person is said to be an accountant today because he has studied accountancy in the past. A woman is said to have 4 children because she gave birth to four children in her past. A person who says he is an actor with 15years experience because has appeared in movies for the past fifteen years.</p><p>The point here is our past dictates who we are. In other words, we are our past. In trying to describe who we are we constantly and unknowingly dwell in the past. <strong>Yet many still insist that the past doesn’t matter</strong>.</p><p>Most people try by all means not to dwell on the past. Dwelling on the past is seen as a weakness. <a href="https://www.psychologytoday.com/intl/blog/constructive-wallowing/201605/why-your-past-matters">Tina Gilbertson</a> a psychologist writes “Dwelling on the past is something many Americans don’t like to do; we’re eager to wipe the slate clean and start fresh on a path toward a tomorrow we hope will be brighter than yesterday.”</p><blockquote>“Imagine if you broke a bone and then, not wanting to dwell on the injury, went out and played rugby the next day. How well do you think that would go for you and your broken bone?” — Tina Gilbertson</blockquote><p>The past must be acknowledged. We must be in constant reference to it. We ought to refer to our past because it cements our growth. If we try to delete our personal history from our minds. By insisting on focusing at all times on the present and/or the future. It limits our growth and we continue to be children even as we go into adulthood. What distinguishes adults from children is their past experiences. Adults have gained this experience over the years.</p><h3><strong>How your past determines your future.</strong></h3><p>After graduating from college, I was determined and eager to get a job. I thought getting a job would brighten my future. I moved from company to company. All the companies wanted me to write and present to them a resume. A resume is a document that has details of your past qualifications and past job experience. It is sometimes referred to as a Curriculum Vitae(CV).</p><p>To write a resume I had to dig deep into my past. I saw first hand that to get as future you desire. <strong><em>The past is very much the decider.</em></strong> My memory was called into action. I had to remember every school I attended including the exact years. I had to put every detail of my past that I thought could win me the job.</p><p>We use our ability to create a picture of the future to help us make plans. This ability is a product is our past experiences. Our beliefs about what might happen in the future help us to plan for obstacles that will confront us.</p><p><strong><em>Past experiences also prepare us for unexpected failure.</em></strong> Preparing for the possibility of failure enhances planning. Those people who prepare for failure are the ones best equipped to handle problems when they come up.</p><blockquote>“By setting your predictions for the future in a familiar landscape, you allow yourself to use your memories of the past to help you predict what might go wrong in the future.” — <a href="https://www.psychologytoday.com/us/blog/ulterior-motives/201108/your-view-the-future-is-shaped-the-past">Art Markman PhD</a></blockquote><p><strong><em>Past experiences also help prevent you from thinking in an abstract way.</em></strong> Abstract thinking makes you less likely to find specific problems that may arise. This is because the future has many ways of surprising us. Nobody can be completely prepared for what the future will bring. That is why it is important to recognize that the only way you can plan for the future is by drawing on your memories of the past. Envisioning your future in a specific location gives you the best chance of helping yourself succeed.</p><h3><strong>You can change your past</strong></h3><p>Many people view the past as something unchangeable. This belief has made many people stagnant in their lives. Having this belief limits your potential and prevents you from achieving greater heights. This belief is simply incorrect.</p><p>People who view the past as unchangeable like using statements like:</p><ul><li>“<em>I’m not good enough.</em>”</li><li>“<em>I’m Obese</em>”</li><li>“<em>Am never liked by my bosses.</em>”</li><li>“<em>I never have enough money.</em>”</li><li>“<em>I don&#39;t get good jobs.</em>”</li><li>“<em>I have always failed in my business.</em>”</li><li>“<em>I can&#39;t find true love.</em>”</li><li>“<em>I’m Illiterate.</em>”</li></ul><p>The truth is that the past can be rewritten. Every second you are rewriting your past. For example, if you say today that, “<em>I am without a master’s degree.</em>” This statement is true because in your current past you have never studied for a master’s degree. But if spend the next two years studying for a master&#39;s degree and you go on to complete it. The statement “<em>I am without a master’s degree</em>” will no longer be correct. This is because your past will have now changed.</p><blockquote>“When you change the meaning and narrative of your past, you simultaneously change the narrative of your present and future. And vice versa. Changing the narrative of your present and future simultaneously alters the meaning or narrative of your past.” — <a href="https://www.psychologytoday.com/us/blog/quantum-leaps/201907/how-rewrite-your-past-narrative">Benjamin Hardy Ph.D</a></blockquote><p>Viewing the past like this is very effective for goal setting. It acts as a springboard to lift you to success. Most people don’t like goals because it’s emotionally difficult to deal with past failures. All past failures must be viewed as stepping stones to success. It also turns out that succeeding or reaching your goals is a journey with obstacles.</p><h3>The Takeaway</h3><p>The past defines us at the present. Everything you are today is because of your past. Your past determines your future. The past however can be changed. This is because every second you are actually recreating your past. Having this understanding of the past empowers you. It gives you the ability to recreate any situation you are in.</p><h3>References</h3><ul><li><a href="https://www.psychologytoday.com/us/blog/ulterior-motives/201108/your-view-the-future-is-shaped-the-past">Your View of the Future Is Shaped By the Past</a></li><li><a href="https://www.spsp.org/news-center/blog/ji-past-future-self">How do the Past and the Future Influence Your Present Self? | SPSP</a></li><li><a href="https://ninaamir.com/how-does-the-past-affect-your-future/">How Does the Past Affect Your Future? - Nina Amir</a></li><li><a href="https://www.psychologytoday.com/intl/blog/constructive-wallowing/201605/why-your-past-matters">Why Your Past Matters</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=958f6a3ba7e3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/know-thyself-heal-thyself/your-future-is-in-your-past-958f6a3ba7e3">Did You Know That You Can Rewrite Your Past?</a> was originally published in <a href="https://medium.com/know-thyself-heal-thyself">Know Thyself, Heal Thyself</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Importance Of A Quiet Time And Solitude]]></title>
            <link>https://medium.com/know-thyself-heal-thyself/the-importance-of-a-quiet-time-and-solitude-535eabc3ecfc?source=rss-93bfe6f45e07------2</link>
            <guid isPermaLink="false">https://medium.com/p/535eabc3ecfc</guid>
            <category><![CDATA[healthy-lifestyle]]></category>
            <category><![CDATA[wellness-tips]]></category>
            <category><![CDATA[know-thyself-heal-thyself]]></category>
            <category><![CDATA[quietness]]></category>
            <category><![CDATA[wellbeing]]></category>
            <dc:creator><![CDATA[Paul Nasilele]]></dc:creator>
            <pubDate>Fri, 03 Sep 2021 17:26:36 GMT</pubDate>
            <atom:updated>2021-09-03T17:26:36.344Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nhYCtiJn3jOzzFI3" /><figcaption>Photo by <a href="https://unsplash.com/@timbog80?utm_source=medium&amp;utm_medium=referral">Tim Bogdanov</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>We are living in an era where technology is prevalent everywhere. Technology has improved all areas of our lives. It has improved the way we travel, it has improved the way we communicate with our friends and family. The digital space has made transformed the way we do business. Not forgetting the way we work.</p><p>On the other hand, the advance in technology has come with some drawbacks. It is increasingly making it difficult for people to find time for themselves and alone. This has a harmful negative effect on the well-being of everyone.</p><p><strong>The importance of solitude.</strong></p><p><strong>1.</strong> Solitude helps you understand yourself better. Most people live a life that is a reflection of other people’s lives. We strive to be other people. Instead, we need to discover ourselves. Self-knowledge is very fundamental. Spending time alone sheds more light on yourself.</p><p><strong>2.</strong> Solitude helps you to see possibilities that you can not see when in the company of others. Many ideas that have managed to reshape this world were initiated by people in solitude. <a href="https://www.newyorker.com/culture/cultural-comment/the-truth-about-isaac-newtons-productive-plague">Isacc Newton</a> is an example of this. In silence, you commune with yourself and discover new possibilities. When alone you can develop an idea and strengthen it before someone discourages you.</p><p><strong>3.</strong> Solitude helps you evaluate the whole list of options to make the best choice. Sometimes we find ourselves in circumstances where we have too many choices to make. You may find that you have a long list of staff to choose from and we fail to choose the best.</p><p>For example, making a choice on which company you will work for. This is after you have received numerous offers from different companies. Another example could be how you will spend a colossal amount of money you have received. A quiet time alone away from television and friends can help you make the best choice.</p><p><strong>4.</strong> Solitude helps you focus on things that matter the most. Many times we are faced with a long list of competing priorities. A quiet time alone can help you determine which ones are of most importance.</p><p>In conclusion, you need to find quiet time every day. You could turn off the television while cooking or doing chores, turn off the radio and drive in silence, or enjoy a mindful, social-media free lunch break. Like this, you’ll reap the mental and physical benefits.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=535eabc3ecfc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/know-thyself-heal-thyself/the-importance-of-a-quiet-time-and-solitude-535eabc3ecfc">The Importance Of A Quiet Time And Solitude</a> was originally published in <a href="https://medium.com/know-thyself-heal-thyself">Know Thyself, Heal Thyself</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Benefit from Calamities]]></title>
            <link>https://paulnasilele.medium.com/how-to-benefit-from-calamities-4c76dfbc39cf?source=rss-93bfe6f45e07------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c76dfbc39cf</guid>
            <category><![CDATA[growth]]></category>
            <category><![CDATA[positive-thinking]]></category>
            <category><![CDATA[life-lessons]]></category>
            <category><![CDATA[character-building]]></category>
            <category><![CDATA[self-awareness]]></category>
            <dc:creator><![CDATA[Paul Nasilele]]></dc:creator>
            <pubDate>Wed, 01 Sep 2021 09:14:46 GMT</pubDate>
            <atom:updated>2021-09-01T09:14:46.663Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_0zVGwsJSYObseBz" /><figcaption>Photo by <a href="https://unsplash.com/@franciscoegonzalez?utm_source=medium&amp;utm_medium=referral">Francisco Gonzalez</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Human beings are routinely confronted with many problems on a daily basis. These can be financial problems, health problems, and career problems. Others can be relationship heartbreaks and business problems. I must state that it is normal for people to encounter troubles.</p><p>Difficulties can put you on the path of self-discovery. Shortcomings can also help you understand who your true friends are.</p><p>What we need to avoid are problems that start to repeat themselves in our lives. This is a sign of stagnation in our lives. It shows that we are not learning from our bad experiences.</p><p>For example, a person who was unsuccessful in setting up an enterprise. Without a self-introspection to understand what they may have done wrong. They may go on to find themselves performing even worse in a second enterprise.</p><p>This is also common in relationships. Those who experience a failed relationship may find themselves in another failed relationship. The heartbreak ends up being even more painful. It is like history keeps repeating itself.</p><p><strong><em>Why is it so?</em></strong></p><p>People who find themselves trapped in this cycle have one thing in common. They have a habit of shifting the blame on others for any woes that happen to them. They blame the people around them for their calamities. The truth is that the problem is themselves. They must shift focus and look at themselves. Self-examination is key to stop history from repeating itself.</p><p>They must begin to ask themselves tough questions</p><p>For example, a person who is fired at a workplace must first try and examine their conduct at that workplace. This will help them understand what they could have done wrong. Same with relationships. A heartbreak should lead you to examine your character so that you are will be more prepared to enter the next.</p><p>This approach will make calamities in your life act as springboards to elevate your character. Problems will make you wiser.</p><p>I hope you have found this useful. I will be back with more interesting articles. Thank you for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c76dfbc39cf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Upload Multiple Images in Laravel]]></title>
            <link>https://medium.com/geekculture/how-to-upload-multiple-images-in-laravel-b98c95324594?source=rss-93bfe6f45e07------2</link>
            <guid isPermaLink="false">https://medium.com/p/b98c95324594</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[image-uploading]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[php]]></category>
            <dc:creator><![CDATA[Paul Nasilele]]></dc:creator>
            <pubDate>Mon, 30 Aug 2021 06:31:02 GMT</pubDate>
            <atom:updated>2021-08-30T07:24:22.220Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AVdW_cbM62u-qZL-qcxbbg.png" /><figcaption>Image by <a href="https://www.positronx.io/laravel-multiple-images-upload-with-validation-example/">positronx.io</a></figcaption></figure><p>A good number of websites require the user to upload multiple images of a product. This especially applies to e-commerce sites. Multiple images are used to provide a lot of details about the product on sale.</p><p>Implementing multiple image uploads has proven to be difficult for many developers. In this article, I will show you step by step how to upload multiple images using laravel.</p><p><strong>Step 1: </strong>Create a new Laravel project using composer. You can give it any name but in this case, we will name it multipleImages<em>App</em>.</p><pre>composer create-project --prefer-dist laravel/laravel muiltipleImagesApp</pre><p><strong>Step 2: </strong>In the multipleImage<em>App</em> project create a migration to create a products table.</p><pre>cd multipleImagesApp<br>php artisan make:migration create_products_table --create=products</pre><p><strong>Step 3: </strong>In the migration add the <em>name</em> and<em> </em>the <em>description </em>fields<em>.</em></p><pre>&lt;?php</pre><pre>use Illuminate\Support\Facades\Schema;<br>use Illuminate\Database\Schema\Blueprint;<br>use Illuminate\Database\Migrations\Migration;</pre><pre><em>class</em> CreateProductsTable <em>extends</em> <em>Migration<br></em>{<br>  <em>public</em> <em>function</em> up()<br>  {<br>    Schema::create(&#39;products&#39;, <em>function</em> (Blueprint $table) {<br>      $table-&gt;bigIncrements(&#39;id&#39;);<br>      $table-&gt;string(&#39;name&#39;);<br>      $table-&gt;string(&#39;description&#39;);  <br>      $table-&gt;timestamps();<br>  });<br>  }</pre><pre><em>public</em> <em>function</em> down()<br>  {<br>    Schema::dropIfExists(&#39;products&#39;);<br>  }<br>}</pre><p><strong>Step 4:</strong> Create another migration that will create the images.</p><pre>php artisan make:migration create_images_table --create=images</pre><p><strong>Step 5: </strong>In the migration add the fields url and product_id<em>.</em></p><pre>&lt;?php</pre><pre>use Illuminate\Support\Facades\Schema;</pre><pre>use Illuminate\Database\Schema\Blueprint;</pre><pre>use Illuminate\Database\Migrations\Migration;</pre><pre><em>class</em> CreateImagesTable <em>extends</em> <em>Migration<br>{</em></pre><pre><em>public</em> <em>function</em> up(){<br>  Schema::create(&#39;images&#39;, <em>function</em> (Blueprint $table) {<br>    $table-&gt;bigIncrements(&#39;id&#39;);<br>    $table-&gt;string(&#39;url&#39;);<br>    $table-&gt;unsignedBigInteger(&#39;product_id&#39;);<br>    $table-&gt;timestamps();<br>});<br>}</pre><pre><em>public</em> <em>function</em> down(){<br>   Schema::dropIfExists(&#39;images&#39;);<br>}}</pre><p><strong>Step 6: </strong>Next, create two models. One will be called <em>Product</em> and the other will be called <em>Image.</em></p><pre>php artisan make:model Product<br>php artisan make:model Image</pre><p><strong>Step 7: </strong>In the Product model add the<em> title</em> and <em>content</em> fields in the fillable array. Next, create a one-to-many relationship with the <em>Image</em> model.</p><pre>&lt;?php</pre><pre>namespace App;</pre><pre>use Illuminate\Database\Eloquent\Model;</pre><pre><em>class</em> Product <em>extends</em> <em>Model<br></em>{<br>  <em>protected</em> $table = &#39;products&#39;;</pre><pre><em>  protected</em> $fillable = [<br>      &#39;name&#39;, &#39;discription&#39;<br>  ];<br>  <em>public</em> <em>function</em> images()<br>  {<br>   return <em>$this</em>-&gt;hasMany(&#39;App\Image&#39;, &#39;product_id&#39;);<br>  }<br>}</pre><p><strong>Step 8: </strong>In the Image model add the <em>url</em> and the <em>product_id</em> fields in the fillable array. Next, create a one-to-many relationship with the Product model.</p><pre>&lt;?php</pre><pre>namespace App;</pre><pre>use Illuminate\Database\Eloquent\Model;</pre><pre><em>class</em> Image <em>extends</em> <em>Model<br></em>{<br>  <em>protected</em> $table = &#39;images&#39;;</pre><pre>  <em>protected</em> $fillable = [<br>   &#39;url&#39;, &#39;product_id&#39;<br>  ];</pre><pre><em>public</em> <em>function</em> product()<br>{<br>  return <em>$this</em>-&gt;belongsTo(&#39;App\Product&#39;, &#39;product_id&#39;);<br>}</pre><pre>}</pre><p><strong>Step 9:</strong> In the <strong><em>config/</em></strong> folder, add a new disk called <em>my_files</em> in a file called <em>filesystems.php.</em></p><pre>&#39;disks&#39; =&gt; [<br>   &#39;local&#39; =&gt; [<br>      &#39;driver&#39; =&gt; &#39;local&#39;,<br>      &#39;root&#39; =&gt; storage_path(&#39;app&#39;),<br>   ],</pre><pre>&#39;public&#39; =&gt; [<br>      &#39;driver&#39; =&gt; &#39;local&#39;,<br>      &#39;root&#39; =&gt; storage_path(&#39;app/public&#39;),<br>      &#39;url&#39; =&gt; env(&#39;APP_URL&#39;).&#39;/storage&#39;,<br>      &#39;visibility&#39; =&gt; &#39;public&#39;,<br>   ],</pre><pre>&#39;s3&#39; =&gt; [<br>      &#39;driver&#39; =&gt; &#39;s3&#39;,<br>      &#39;key&#39; =&gt; env(&#39;AWS_ACCESS_KEY_ID&#39;),<br>      &#39;secret&#39; =&gt; env(&#39;AWS_SECRET_ACCESS_KEY&#39;),<br>      &#39;region&#39; =&gt; env(&#39;AWS_DEFAULT_REGION&#39;),<br>      &#39;bucket&#39; =&gt; env(&#39;AWS_BUCKET&#39;),<br>      &#39;url&#39; =&gt; env(&#39;AWS_URL&#39;),<br>   ],</pre><pre>&#39;my_files&#39; =&gt; [<br>      &#39;driver&#39; =&gt; &#39;local&#39;,<br>      &#39;root&#39;   =&gt; public_path() . &#39;/&#39;<br>   ]<br>],</pre><p><strong>Step 10: </strong>Next, create a controller and name it <em>ProductController</em>.</p><pre>php artisan make:controller ProductController</pre><p><strong>Step 11: </strong>To the<em> ProductController</em>, add a function called<em> uploadImages.</em></p><pre>&lt;?php</pre><pre>namespace App\Http\Controllers\Admin;</pre><pre>use Illuminate\Http\Request;</pre><pre>use App\Http\Controllers\Controller;<br>use Illuminate\Support\Facades\DB;<br>use App\Product;<br>use Image;<br>use Storage;</pre><pre><em>class</em> ProductController <em>extends</em> <em>Controller<br></em>{<br>   <em>public</em> <em>function</em> addProduct(Request $request)<br>   {<br>      <em>$this</em>-&gt;validate($request, [<br>         &#39;name&#39; =&gt; &#39;required|string|max:255&#39;,<br>         &#39;description&#39; =&gt; &#39;required|string|max:855&#39;,<br>   ]);</pre><pre>   $product = new Product;<br>   $product-&gt;name = $request-&gt;name;<br>   $product-&gt;description = $request-&gt;description;<br>   $product-&gt;save();</pre><pre>   foreach ($request-&gt;file(&#39;images&#39;) as $imagefile) {</pre><pre>     $image = new Image;<br>     $path = $imagefile-&gt;store(&#39;/images/resource&#39;, [&#39;disk&#39; =&gt;   &#39;my_files&#39;]);<br>     $image-&gt;url = $path;<br>     $image-&gt;product_id = $product-&gt;id;<br>     $image-&gt;save();<br>   }}}</pre><p><strong>Step 12: </strong>Finally in the <em>web.php</em> file in the routes folder</p><pre>&lt;?phpuse Illuminate\Http\Request;</pre><pre>Route::post(&#39;addProduct&#39;, &#39;ProductController@addProduct&#39;)-&gt;name(&#39;products.uploadproduct&#39;);</pre><p><strong>Step 13:</strong> Create a file called <em>uploadImages.blade.php.</em></p><pre>&lt;!DOCTYPE <em>html</em>&gt;<br>&lt;html&gt;<br>&lt;head&gt;<br> &lt;meta <em>charset</em>=&quot;utf-8&quot;&gt;<br> &lt;meta <em>name</em>=&quot;viewport&quot; <em>content</em>=&quot;width=device-width, initial-scale=1,   shrink-to-fit=no&quot;&gt;<br>&lt;title&gt;Multiple Image upload&lt;/title&gt;<br>&lt;/head&gt;</pre><pre>&lt;body&gt;</pre><pre>&lt;div&gt;<br>&lt;h3&gt;Upload a Images&lt;/h3&gt;<br>&lt;hr&gt;</pre><pre>&lt;form <em>method</em>=&quot;POST&quot; <em>action</em>=&quot;{{ route(&#39;products.uploadproducts&#39;) }}&quot; <em>enctype</em>=&quot;multipart/form-data&quot; &gt;<br>{{ csrf_field() }}<br>&lt;div &gt;<br>&lt;label&gt;Name&lt;/label&gt;<br>&lt;input <em>type</em>=&quot;text&quot; <em>name</em>=&quot;name&quot; <em>placeholder</em>=&quot;Enter Product Name&quot;&gt;</pre><pre>&lt;label&gt;Discription&lt;/label&gt;<br>&lt;textarea name=&quot;description&quot; rows=&quot;4&quot; &gt;<br>&lt;/textarea&gt;&lt;/div&gt;</pre><pre>&lt;div &gt;<br>&lt;label&gt;Choose Images&lt;/label&gt;<br>&lt;input <em>type</em>=&quot;file&quot;  <em>name</em>=&quot;images&quot; multiple&gt;<br>&lt;/div&gt;</pre><pre>&lt;hr&gt;</pre><pre>&lt;button <em>type</em>=&quot;submit&quot; &gt;Submit&lt;/button&gt;</pre><pre>&lt;/form&gt;</pre><pre>&lt;/div&gt;</pre><pre>&lt;/body&gt;</pre><pre>&lt;/html&gt;</pre><p>And there we have it. I hope you have found this useful. I will be back with more interesting articles. Thank you for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b98c95324594" width="1" height="1" alt=""><hr><p><a href="https://medium.com/geekculture/how-to-upload-multiple-images-in-laravel-b98c95324594">How to Upload Multiple Images in Laravel</a> was originally published in <a href="https://medium.com/geekculture">Geek Culture</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5 clear signs that your man is a potential abuser.]]></title>
            <link>https://paulnasilele.medium.com/5-clear-signs-that-your-man-is-a-potential-abuser-ddbfec6f72e5?source=rss-93bfe6f45e07------2</link>
            <guid isPermaLink="false">https://medium.com/p/ddbfec6f72e5</guid>
            <category><![CDATA[marriage]]></category>
            <category><![CDATA[relationships]]></category>
            <category><![CDATA[gender-violence]]></category>
            <category><![CDATA[dating-advice]]></category>
            <category><![CDATA[love]]></category>
            <dc:creator><![CDATA[Paul Nasilele]]></dc:creator>
            <pubDate>Mon, 23 Aug 2021 05:49:20 GMT</pubDate>
            <atom:updated>2021-08-31T16:52:59.879Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uTYRk4Dbo85apaM0" /><figcaption>Photo by <a href="https://unsplash.com/@mxsh?utm_source=medium&amp;utm_medium=referral">M.</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>A large number of women are stuck in abusive relationships. They find themselves with men that are irresponsible and care less about them. Even when they choose to get out of such a relationship. The trend repeats itself. They fall into the same trap and find themselves in other bad relationships.</p><blockquote>A 2018 analysis of prevalence data from 2000–2018 across 161 countries and areas, conducted by WHO on behalf of the UN Interagency working group on violence against women, found that worldwide, nearly 1 in 3, or 30%, of women have been subjected to physical and/or sexual violence by an intimate partner — <a href="https://www.who.int/news-room/fact-sheets/detail/violence-against-women">WHO</a></blockquote><p>The question that begs an answer is what are the signs that will help a woman pinpoint a potential abuser. It would be helpful if a woman can understand such signs at least in the first couple of months. The fact of the matter is that a woman has the tools in her hands to determine whether a man is abusive or caring. In this article, I will share five clear signs that a woman can use to pinpoint a potential abuser.</p><p><strong>1. Men that kickstart a relationship without a proposal</strong></p><p>This I know will surprise you. The reality is a lot of relationships today actually start without a man proposing love to a woman. When a woman notices that a man begins to spend a lot of time with them. They usually assume that a relationship has commenced. Even when the man has not stated his intentions and his plans. Commencing a relationship this way is a trap. It makes the man less accountable for the future outcome of the relationship.</p><p>In other words, he becomes less responsible for the future of that relationship. It is important to allow the man to propose love. He must explain his intention and what he wants out of that relationship he is seeking. This will reduce his tendency to abuse you in the future. If he is reluctant to do this, it would be helpful to suspend the relationship. It shows that he doesn&#39;t value you that much. He is a potential abuser.</p><p><strong>2. Men that are too confident upon meeting you.</strong></p><p>Unfortunately, there are a lot of women who are attracted to men who display so much confidence. But in most cases, a relationship with such a man ends in misery on the part of the woman.</p><p>You need to understand that a man whose heart you have captured will be overpowered by your presence. This is especially if he is not sure you like him back. The uncertainty of whether you love him back will send him into anxiety mode. It will also lower his confidence. This anxiety only disappears when he starts to see that you also love him back. Over-confidence just shows that he doesn’t value you that much. He is a potential abuser.</p><p><strong>3. Men that spend too much money on you.</strong></p><p>Most men who tend to be abusive have the habit of spending a huge amount of money on women. They spend a lot of money very early in the relationship. They take women to expensive restaurants and hotels. Their focus is on material things because their hearts are not deeply in love.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Bq-8_0u-4qdHxHym" /><figcaption>Photo by <a href="https://unsplash.com/@ibrahimboran?utm_source=medium&amp;utm_medium=referral">Ibrahim Boran</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Once a man spends a lot of money on you, He indirectly makes you indebted to him. This opens the door to many forms of abuse. These are verbal, physical, and sexual abuse.</p><p><strong>4. A man who is quick to demand sex</strong></p><p>Having sex in the first forty nights of meeting a man is a serious red flag. It is one of the clearest signals that you are entering a relationship that will be miserable. A man must cultivate love with you first before reaching the point of having sex with you. The opposite of that is not true.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CxWvvbUrNCzJoEyY" /><figcaption>Photo by <a href="https://unsplash.com/@heftiba?utm_source=medium&amp;utm_medium=referral">Toa Heftiba</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Demanding sex in the first few days of meeting you clearly shows how little the value he has placed on you. A man with big plans for you will not take you to bed in the first days of meeting you.</p><p><strong>5. A man who does not introduce you to his close family members.</strong></p><p>One of the biggest signs that a man is deeply in love with you is his willingness to introduce you to his close family members. This he does because he sees a future with you.</p><p>On the other hand, a man who does not see a future with you will choose to isolate you from his family. This is to make it easy for him to step out of that relationship without much difficulty. He will owe no family member an explanation.</p><h3>Conclusion</h3><p>And there we have it. These are some of the clear signs that women can look out for. I hope you have found this useful. I will be back with more interesting articles. Thank you for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ddbfec6f72e5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Form Validation Using Vue.js & VeeValidate]]></title>
            <link>https://javascript.plainenglish.io/form-validation-using-vue-js-veevalidate-31a2f56b8d3f?source=rss-93bfe6f45e07------2</link>
            <guid isPermaLink="false">https://medium.com/p/31a2f56b8d3f</guid>
            <category><![CDATA[frontend-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[vuejs]]></category>
            <dc:creator><![CDATA[Paul Nasilele]]></dc:creator>
            <pubDate>Wed, 18 Aug 2021 06:14:47 GMT</pubDate>
            <atom:updated>2021-08-18T10:00:07.162Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*m7oxJOu-mOk1nUtx" /><figcaption>Photo by <a href="https://unsplash.com/@nickmorrison?utm_source=medium&amp;utm_medium=referral">Nick Morrison</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The Vue.js framework has many plugins that can be used to implement frontend form validation. One of them is<strong> VeeValidate</strong>. VeeValidate can be used to build advanced validation. This is because it comes with inbuilt validation rules for different types of fields. This article will show you how to use<strong> </strong>VeeValidate and <strong>Vue</strong> to implement form validation.</p><p><strong>Step 1:</strong> Create a new Vue project called RegisterApp. Read the Vue Project setup <a href="https://cli.vuejs.org/guide/creating-a-project.html">here</a>.</p><pre>vue create RegisterApp</pre><p><strong>Step 2:</strong> Install <em>VeeValidate </em>into the<em> RegisterApp. </em><a href="https://vee-validate.logaretm.com/v3/overview.html#installation">Read here for VeeValidate setup</a></p><pre>cd RegisterApp<br>npm install vee-validate --save</pre><p><strong>Step 3:</strong> In the <em>main.js</em> file register the <em>ValidationProvider</em> globally using the <strong><em>Vue.component()</em></strong> function.</p><pre>import { ValidationProvider } from &#39;vee-validate&#39;;<br>import { ValidationObserver } from &#39;vee-validate&#39;;</pre><pre>Vue.component(&#39;ValidationProvider&#39;, ValidationProvider);</pre><p><strong>Step 4:</strong> Next install all the available rules. <a href="https://vee-validate.logaretm.com/v3/guide/rules.html#installing-all-rules">Read here to find available roles</a></p><pre>import { ValidationProvider } from &#39;vee-validate/dist/vee-validate.full.esm&#39;;</pre><p>The final <em>main.js</em> file must look like this.</p><pre>import Vue from &#39;vue&#39;<br>import App from &#39;./App.vue&#39;<br>import { ValidationObserver } from &#39;vee-validate&#39;<br>import { ValidationProvider } from &#39;vee-validate/dist/vee-validate.full.esm&#39;;</pre><pre>Vue.component(&#39;ValidationProvider&#39;, ValidationProvider);<br>Vue.config.productionTip = false</pre><pre>new Vue({<br>  render: <em>h</em> =&gt; h(App),<br>}).$mount(&#39;#app&#39;)</pre><p><strong>Step 5:</strong> In the <em>components/</em> folder create a component called <strong><em>RegisterForm.vue.</em></strong></p><pre>&lt;template&gt;<br> &lt;div&gt;<br> &lt;h2&gt;VeeValidate Form&lt;/h2&gt;<br><br>&lt;/div&gt;</pre><pre>&lt;/template&gt;</pre><pre>&lt;script&gt;<br>  export default {<br>   data: () =&gt; (),<br>  methods: {<br>    <br>  }<br>}}<br>&lt;/script&gt;<br></pre><p><strong>Step 6:</strong> In the <em>&lt;script&gt;&lt;/script&gt;</em> section create the<em> firstname</em>, <em>lastname</em> , <em>email</em> and <em>password</em> as data properties.</p><pre>&lt;script&gt;<br>  export default {<br>   data: () =&gt; ({<br>  <br>       name: &#39;&#39;,<br>       email: &#39;&#39;,<br>       password: &#39;&#39;,<br>   <br>  }),<br>  methods: {<br>   <br>  }<br>}}<br>&lt;/script&gt;</pre><p><strong>Step 7:</strong> In the <em>&lt;template&gt;&lt;/template&gt;</em> section create a form and wrap it in a <em>ValidationObserver.</em></p><pre>&lt;template&gt;<br> &lt;div&gt;<br> &lt;h2&gt;VeeValidate Form&lt;/h2&gt;<br> &lt;ValidationObserver <em>v-slot</em>=&quot;{ handleSubmit }&quot;&gt;<br>    &lt;form @<em>submit</em>.<em>prevent</em>=&quot;handleSubmit(onSubmit)&quot;&gt;</pre><pre>    &lt;/form&gt;<br>&lt;/ValidationObserver&gt;</pre><pre>&lt;/div&gt;</pre><pre>&lt;/template&gt;</pre><p><strong>Step 8:</strong> Create inputs for <em>firstname</em>, <em>lastname</em>, <em>email</em> and <em>password. </em>Wrap every input with <strong><em>ValidationProvider </em></strong>component which acts as a validator for your fields<strong><em>.</em></strong></p><pre>&lt;template&gt;<br> &lt;div&gt;<br> &lt;h2&gt;VeeValidate Form&lt;/h2&gt;<br> &lt;ValidationObserver <em>v-slot</em>=&quot;{ handleSubmit }&quot;&gt;<br> &lt;form @<em>submit</em>.<em>prevent</em>=&quot;handleSubmit(onSubmit)&quot;&gt;</pre><pre>&lt;ValidateProvider <em>name</em>=&quot;firstname&quot; <em>rules</em>=&quot;required|alpha&quot; <em>v-slot</em>=&quot;{ errors }&quot;&gt;<br>&lt;div&gt;<br>  &lt;label&gt;Firstname&lt;/label&gt;<br>  &lt;input <em>type</em>=&quot;text&quot; <em>v-model</em>=&quot;firstname&quot;&gt;<br>  &lt;span&gt;{{ errors[0] }}&lt;/span&gt;<br>&lt;/div&gt;<br>&lt;/ValidationProvider&gt;</pre><pre>&lt;ValidateProvider <em>name</em>=&quot;lastname&quot; <em>rules</em>=&quot;required|alpha&quot; <em>v-slot</em>=&quot;{ errors }&quot;&gt;<br>&lt;div&gt;<br>  &lt;label&gt;Lastname&lt;/label&gt;<br>  &lt;input <em>type</em>=&quot;text&quot; <em>v-model</em>=&quot;lastname&quot;&gt;<br>  &lt;span&gt;{{ errors[0] }}&lt;/span&gt;<br>&lt;/div&gt;<br>&lt;/ValidationProvider&gt;</pre><pre>&lt;ValidateProvider <em>name</em>=&quot;email&quot; <em>rules</em>=&quot;required|email&quot; <em>v-slot</em>=&quot;{ errors }&quot;&gt;<br>&lt;div&gt;<br>  &lt;label&gt;Email&lt;/label&gt;<br>  &lt;input <em>type</em>=&quot;email&quot; <em>v-model</em>=&quot;email&quot;&gt;<br>  &lt;span&gt;{{ errors[0] }}&lt;/span&gt;<br>&lt;/div&gt;<br>&lt;/ValidationProvider&gt;</pre><pre>&lt;ValidateProvider <em>name</em>=&quot;password&quot; <em>rules</em>=&quot;required&quot; <em>v-slot</em>=&quot;{ errors }&quot;&gt;<br>&lt;div&gt;<br>  &lt;label&gt;Password&lt;/label&gt;<br>  &lt;input <em>type</em>=&quot;password&quot; <em>v-model</em>=&quot;password&quot;&gt;<br>  &lt;span&gt;{{ errors[0] }}&lt;/span&gt;<br>&lt;/div&gt;<br>&lt;/ValidationProvider&gt;</pre><pre>&lt;input <em>type</em>=&quot;submit&quot; <em>text</em>=&quot;Submit&quot;&gt;</pre><pre>&lt;/form&gt;</pre><pre>&lt;/ValidationObserver&gt;<br>&lt;/div&gt;</pre><pre>&lt;/template&gt;</pre><p>The final <strong><em>RegisterForm.vue</em></strong> should look like this.</p><pre>&lt;template&gt;<br> &lt;div&gt;<br> &lt;h2&gt;VeeValidate Form&lt;/h2&gt;<br> &lt;ValidationObserver <em>v-slot</em>=&quot;{ handleSubmit }&quot;&gt;<br> &lt;form @<em>submit</em>.<em>prevent</em>=&quot;handleSubmit(onSubmit)&quot;&gt;</pre><pre>&lt;ValidateProvider <em>name</em>=&quot;firstname&quot; <em>rules</em>=&quot;required|alpha&quot; <em>v-slot</em>=&quot;{ errors }&quot;&gt;<br>&lt;div&gt;<br>  &lt;label&gt;Firstname&lt;/label&gt;<br>  &lt;input <em>type</em>=&quot;text&quot; <em>v-model</em>=&quot;formData.firstname&quot;&gt;<br>  &lt;span&gt;{{ errors[0] }}&lt;/span&gt;<br>&lt;/div&gt;<br>&lt;/ValidationProvider&gt;</pre><pre>&lt;ValidateProvider <em>name</em>=&quot;lastname&quot; <em>rules</em>=&quot;required|alpha&quot; <em>v-slot</em>=&quot;{ errors }&quot;&gt;<br>&lt;div&gt;<br>  &lt;label&gt;Lastname&lt;/label&gt;<br>  &lt;input <em>type</em>=&quot;text&quot; <em>v-model</em>=&quot;formData.lastname&quot;&gt;<br>  &lt;span&gt;{{ errors[0] }}&lt;/span&gt;<br>&lt;/div&gt;<br>&lt;/ValidationProvider&gt;</pre><pre>&lt;ValidateProvider <em>name</em>=&quot;email&quot; <em>rules</em>=&quot;required|email&quot; <em>v-slot</em>=&quot;{ errors }&quot;&gt;<br>&lt;div&gt;<br>  &lt;label&gt;Email&lt;/label&gt;<br>  &lt;input <em>type</em>=&quot;text&quot; <em>v-model</em>=&quot;formData.email&quot;&gt;<br>  &lt;span&gt;{{ errors[0] }}&lt;/span&gt;<br>&lt;/div&gt;<br>&lt;/ValidationProvider&gt;</pre><pre>&lt;ValidateProvider <em>name</em>=&quot;password&quot; <em>rules</em>=&quot;required|alpha&quot; <em>v-slot</em>=&quot;{ errors }&quot;&gt;<br>&lt;div&gt;<br>  &lt;label&gt;Password&lt;/label&gt;<br>  &lt;input <em>type</em>=&quot;text&quot; <em>v-model</em>=&quot;formData.password&quot;&gt;<br>  &lt;span&gt;{{ errors[0] }}&lt;/span&gt;<br>&lt;/div&gt;<br>&lt;/ValidationProvider&gt;</pre><pre>&lt;input <em>type</em>=&quot;submit&quot; <em>text</em>=&quot;Submit&quot;&gt;</pre><pre>&lt;/form&gt;</pre><pre>&lt;/ValidationObserver&gt;<br>&lt;/div&gt;</pre><pre>&lt;/template&gt;</pre><pre>&lt;script&gt;<br>  export default {<br>   data: () =&gt; ({<br>  <br>       name: &#39;&#39;,<br>       email: &#39;&#39;,<br>       password: &#39;&#39;,<br>   <br>  }),<br>  methods: {<br>    onSubmit(){<br>      console.log(<em>this</em>.formData);<br>  }<br>}}<br>&lt;/script&gt;</pre><p><strong>Step 9:</strong> Import the <em>RegisterForm.vue</em> into the <em>App.vue</em>.</p><pre>&lt;template&gt;<br>  &lt;div <em>id</em>=&quot;app&quot;&gt;<br>  &lt;RegisterForm /&gt;<br>  &lt;/div&gt;<br>&lt;/template&gt;</pre><pre>&lt;script&gt;<br>import RegisterForm from &quot;./components/RegisterForm&quot;;</pre><pre>export default {<br>  name: &quot;App&quot;,<br>  components: {<br>     RegisterForm<br>  }<br>}<br>&lt;/script&gt;</pre><pre>&lt;style&gt;&lt;/style&gt;</pre><p>Run the app</p><p>And there we have it. I hope you have found this useful. I will be back with more interesting articles. Thank you for reading.</p><p><em>More content at </em><a href="http://plainenglish.io/"><strong><em>plainenglish.io</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=31a2f56b8d3f" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/form-validation-using-vue-js-veevalidate-31a2f56b8d3f">Form Validation Using Vue.js &amp; VeeValidate</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Upload a Video in Laravel]]></title>
            <link>https://medium.com/geekculture/how-to-upload-a-video-in-laravel-1dc07bde3839?source=rss-93bfe6f45e07------2</link>
            <guid isPermaLink="false">https://medium.com/p/1dc07bde3839</guid>
            <category><![CDATA[image-upload]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[web-programming]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[laravel-framework]]></category>
            <dc:creator><![CDATA[Paul Nasilele]]></dc:creator>
            <pubDate>Sat, 14 Aug 2021 17:24:51 GMT</pubDate>
            <atom:updated>2021-08-15T15:27:06.135Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-hhXLNbVb9ivfWEH" /><figcaption>Photo by <a href="https://unsplash.com/@bencollins?utm_source=medium&amp;utm_medium=referral">Ben Collins</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Many websites and online systems require the user to upload a video to the internet. This feature is common on social media websites, news websites, e-learning websites, online magazines, etc.</p><p>Many web developers find it difficult to implement this feature on websites. However, web frameworks like laravel can make it easier to implement video upload on websites. In this article, I will show you step by step how to upload an mp4 video using laravel.</p><p><strong>Step 1: </strong>Create a new Laravel project using composer. You can give it any name but in this case, we will name it video<em>App</em>.</p><pre>composer create-project --prefer-dist laravel/laravel videoApp</pre><p><strong>Step 2: </strong>In the <em>videoApp</em> project create a migration to create a <em>videos</em> table.</p><pre>cd videoApp<br>php artisan make:migration create_videos_table --create=videos</pre><p><strong>Step 3: </strong>In the migration add the fields <em>video</em> and <em>title.</em></p><pre>&lt;?php</pre><pre>use Illuminate\Support\Facades\Schema;<br>use Illuminate\Database\Schema\Blueprint;<br>use Illuminate\Database\Migrations\Migration;</pre><pre><em>class</em> CreateVideosTable <em>extends</em> <em>Migration<br></em>{<br>  <em>public</em> <em>function</em> up()<br>  {<br>    Schema::create(&#39;videos&#39;, <em>function</em> (Blueprint $table) {<br>      $table-&gt;bigIncrements(&#39;id&#39;);<br>      $table-&gt;string(&#39;title&#39;);<br>      $table-&gt;string(&#39;video&#39;);<br>      $table-&gt;timestamps();<br>  });<br>  }</pre><pre><em>  public</em> <em>function</em> down()<br>  {<br>    Schema::dropIfExists(&#39;videos&#39;);<br>  }<br>}</pre><p><strong>Step 4: </strong>Next, create a model called <em>Video.</em></p><pre>php artisan make:model Video</pre><p><strong>Step 5: </strong>In the model add the <em>video</em> fields and <em>title</em> fields in the fillable array.</p><pre>&lt;?php</pre><pre>namespace App;</pre><pre>use Illuminate\Database\Eloquent\Model;</pre><pre><em>class</em> Video <em>extends</em> <em>Model<br></em>{<br>  <em>protected</em> $table = &#39;videos&#39;;</pre><pre>  <em>protected</em> $fillable = [<br>      &#39;title&#39;, &#39;video&#39;<br>  ];</pre><pre>}</pre><p><strong>Step 6:</strong> In the <strong><em>config/</em></strong> folder, add a new disk called <em>my_files</em> in a file called <em>filesystems.php.</em></p><pre>&#39;disks&#39; =&gt; [<br>   &#39;local&#39; =&gt; [<br>      &#39;driver&#39; =&gt; &#39;local&#39;,<br>      &#39;root&#39; =&gt; storage_path(&#39;app&#39;),<br>   ],</pre><pre>   &#39;public&#39; =&gt; [<br>      &#39;driver&#39; =&gt; &#39;local&#39;,<br>      &#39;root&#39; =&gt; storage_path(&#39;app/public&#39;),<br>      &#39;url&#39; =&gt; env(&#39;APP_URL&#39;).&#39;/storage&#39;,<br>      &#39;visibility&#39; =&gt; &#39;public&#39;,<br>   ],</pre><pre>   &#39;s3&#39; =&gt; [<br>      &#39;driver&#39; =&gt; &#39;s3&#39;,<br>      &#39;key&#39; =&gt; env(&#39;AWS_ACCESS_KEY_ID&#39;),<br>      &#39;secret&#39; =&gt; env(&#39;AWS_SECRET_ACCESS_KEY&#39;),<br>      &#39;region&#39; =&gt; env(&#39;AWS_DEFAULT_REGION&#39;),<br>      &#39;bucket&#39; =&gt; env(&#39;AWS_BUCKET&#39;),<br>      &#39;url&#39; =&gt; env(&#39;AWS_URL&#39;),<br>   ],</pre><pre>   &#39;my_files&#39; =&gt; [<br>      &#39;driver&#39; =&gt; &#39;local&#39;,<br>      &#39;root&#39;   =&gt; public_path() . &#39;/&#39;<br>   ]<br>],</pre><p><strong>Step 5: </strong>Next, create a controller and name it VideoController.</p><pre>php artisan make:controller VideoController</pre><p><strong>Step 6: </strong>To the <em>VideoController</em>, add a function called<em> uploadVideo.</em></p><pre>&lt;?php</pre><pre>namespace App\Http\Controllers\Admin;</pre><pre>use Illuminate\Http\Request;</pre><pre>use App\Http\Controllers\Controller;<br>use Illuminate\Support\Facades\DB;<br>use App\Video;<br>use Storage;</pre><pre><em>class</em> VideoController <em>extends</em> <em>Controller<br></em>{<br>   <em>public</em> <em>function</em> uploadVideo(Request $request)<br>   {<br>      <em>$this</em>-&gt;validate($request, [<br>         &#39;title&#39; =&gt; &#39;required|string|max:255&#39;,<br>         &#39;video&#39; =&gt; &#39;required|file|mimetypes:video/mp4&#39;,<br>   ]);</pre><pre>   $video = new Video;<br>   $video-&gt;title = $request-&gt;title;</pre><pre>   if ($request-&gt;hasFile(&#39;video&#39;))<br>   {<br>     $path = $request-&gt;file(&#39;video&#39;)-&gt;store(&#39;videos&#39;, [&#39;disk&#39; =&gt;      &#39;my_files&#39;]);</pre><pre>    $video-&gt;video = $path;<br>   }<br>   $video-&gt;save();<br>   <br>  }</pre><pre>}</pre><p><strong>Step 7: </strong>Finally in the <em>web.php</em> file in the routes folder</p><pre>&lt;?phpuse Illuminate\Http\Request;</pre><pre>Route::post(&#39;uploadVideo&#39;, &#39;VideoController@uploadVideo&#39;)-&gt;name(&#39;videos.uploadedVideo&#39;);</pre><p><strong>Step 8:</strong> Create a file called <em>uploadVideo.blade.php.</em></p><pre>&lt;!DOCTYPE <em>html</em>&gt;<br>&lt;html&gt;<br>&lt;head&gt;<br> &lt;meta <em>charset</em>=&quot;utf-8&quot;&gt;<br> &lt;meta <em>name</em>=&quot;viewport&quot; <em>content</em>=&quot;width=device-width, initial-scale=1,   shrink-to-fit=no&quot;&gt;<br>&lt;title&gt;Video upload&lt;/title&gt;<br>&lt;/head&gt;</pre><pre>&lt;body&gt;</pre><pre>&lt;div&gt;<br>&lt;h3&gt;Upload a video&lt;/h3&gt;<br>&lt;hr&gt;</pre><pre>&lt;form <em>method</em>=&quot;POST&quot; <em>action</em>=&quot;{{ route(&#39;videos.uploadVideo&#39;) }}&quot; <em>enctype</em>=&quot;multipart/form-data&quot; &gt;<br>{{ csrf_field() }}<br>&lt;div &gt;<br>&lt;label&gt;Title&lt;/label&gt;<br>&lt;input <em>type</em>=&quot;text&quot; <em>name</em>=&quot;title&quot; <em>placeholder</em>=&quot;Enter Title&quot;&gt;<br>&lt;/div&gt;</pre><pre>&lt;div &gt;<br>&lt;label&gt;Choose Video&lt;/label&gt;<br>&lt;input <em>type</em>=&quot;file&quot;  <em>name</em>=&quot;video&quot;&gt;<br>&lt;/div&gt;</pre><pre>&lt;hr&gt;</pre><pre>&lt;button <em>type</em>=&quot;submit&quot; &gt;Submit&lt;/button&gt;</pre><pre>&lt;/form&gt;</pre><pre>&lt;/div&gt;</pre><pre>&lt;/body&gt;</pre><pre>&lt;/html&gt;</pre><p>And there we have it. I hope you have found this useful. I will be back with more interesting articles. Thank you for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1dc07bde3839" width="1" height="1" alt=""><hr><p><a href="https://medium.com/geekculture/how-to-upload-a-video-in-laravel-1dc07bde3839">How to Upload a Video in Laravel</a> was originally published in <a href="https://medium.com/geekculture">Geek Culture</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Build API Data Pagination Using Node Express]]></title>
            <link>https://javascript.plainenglish.io/how-to-build-api-data-pagination-using-node-express-58d31d6b9e2a?source=rss-93bfe6f45e07------2</link>
            <guid isPermaLink="false">https://medium.com/p/58d31d6b9e2a</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Paul Nasilele]]></dc:creator>
            <pubDate>Wed, 11 Aug 2021 06:44:58 GMT</pubDate>
            <atom:updated>2021-08-11T10:09:45.201Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*8Wl4vESTbzJ-RLNGXw_8yA.png" /><figcaption>Image by<a href="https://aioseo.com/pagination-seo/"> AIOSEO</a></figcaption></figure><p><strong>Node Express</strong> is a JavaScript framework that can be used to develop a variety of web applications. It can be used to develop web APIs that can be consumed by various client apps(web app or mobile apps). <strong>Data pagination</strong> must be implemented on API responses that involve long lists of data. This article will show you step by step how data pagination is implemented in Node Express APIs.</p><p>This example will be about a news app.</p><p><strong>Step 1: </strong>Create an empty folder called <strong><em>newsapp</em></strong>.</p><pre>$ mkdir newsapp<br>cd newsapp<br>$ npm init</pre><p><strong>Step 2:</strong> Set up express in the folder. <a href="https://expressjs.com/en/starter/installing.html">Read here for information</a></p><pre>$ npm install express --save</pre><p><strong>Step 3:</strong> Install mongoose to the project.</p><pre>$ npm install mongoose --save</pre><p><strong>Step 4:</strong> Create a file called <em>article.js</em> in the root folder. Import mongoose in the <em>article.js</em> file using the requite function.</p><pre><em>const</em> mongoose = require(&#39;mongoose&#39;)</pre><p><strong>Step 5:</strong> Create a schema that will represent the news article with the <em>title</em> and <em>content</em> properties.</p><pre><em>const</em> mongoose = require(&#39;mongoose&#39;)</pre><pre><em>const</em> ArticleSchema = new mongoose.Schema({<br>   title: { <br>    type: String,<br>    required: true<br>   },<br>   content: {<br>    type: String,<br>    required: true<br> }</pre><pre>})</pre><p><strong>Step 6:</strong> The next step is compiling our schema into a model and then export it. <a href="https://mongoosejs.com/docs/index.html">Read here for more information</a></p><pre><em>module</em>.<em>exports</em> = mongoose.model(&#39;Article&#39;, ArticleSchema)</pre><p>The final <strong><em>article.js</em></strong> file will look like this</p><pre><em>const</em> mongoose = require(&#39;mongoose&#39;)</pre><pre><em>const</em> ArticleSchema = new mongoose.Schema({<br>   title: { <br>    type: String,<br>    required: true<br>   },<br>   content: {<br>    type: String,<br>    required: true<br> }</pre><pre>})</pre><pre><em>module</em>.<em>exports</em> = mongoose.model(&#39;Article&#39;, ArticleSchema)</pre><p><strong>Step 7:</strong>In the index.js file, import <strong>mongoose</strong>, and<strong> express</strong> using the <em>require()</em> function.</p><pre><em>const</em> express = require(&#39;express&#39;)<br><em>const</em> newsapp = express()<br><em>const</em> mongoosedb = require(&#39;mongoose&#39;)</pre><p><strong>Step 8:</strong> Import the <em>articles.js</em> file to the <em>index.js</em> file.</p><pre><em>const</em> article = require(&#39;./articles&#39;)</pre><p><strong>Step 9:</strong> Connect to the MongoDB database.</p><pre>mongoose.connect(&#39;mongodb://localhost:27017/test&#39;, {useNewUrlParser: true, useUnifiedTopology: true});</pre><p><strong>Step 10:</strong> Using a promise, display a list of news articles that will come from the database.</p><pre><em>const</em> db = mongoose.connection<br>db.once(&#39;open&#39;, <em>async</em> () =&gt; {<br>  if (await article.countDocuments().exec() &gt; 0) return</pre><pre>Promise.all([</pre><pre>article.create({ title: &#39;article 1&#39;, <br>                content: &quot;News content for article 1&quot; }),</pre><pre>article.create({ title: &#39;article 2&#39;, <br>                content: &quot;News content for article 2&quot; }),</pre><pre>article.create({ title: &#39;article 3&#39;, <br>                content: &quot;News content for article 3&quot; }),</pre><pre>article.create({ title: &#39;article 4&#39;, <br>                content: &quot;News content for article 4&quot; }),</pre><pre>article.create({ title: &#39;article 5&#39;, <br>                content: &quot;News content for article 5&quot; }),</pre><pre>article.create({ title: &#39;article 6&#39;, <br>                content: &quot;News content for article 6&quot; }),</pre><pre>article.create({ title: &#39;article 7&#39;, <br>                content: &quot;News content for article 7&quot; }),</pre><pre>article.create({ title: &#39;article 8&#39;, <br>                content: &quot;News content for article 8&quot; }),</pre><pre>article.create({ title: &#39;article 9&#39;, <br>                content: &quot;News content for article 9&quot; }),</pre><pre>article.create({ title: &#39;article 10&#39;, <br>                 content: &quot;News content for article 10&quot; }),</pre><pre>article.create({ title: &#39;article 11&#39;, <br>                content: &quot;News content for article 11&quot; }),</pre><pre>article.create({ title: &#39;article 12&#39;, <br>                content: &quot;News content for article 12&quot; }),</pre><pre>article.create({ title: &#39;article 13&#39;, <br>                content: &quot;News content for article 13&quot; })</pre><pre>]).then(() =&gt; console.log(&#39;Added Articles&#39;))</pre><pre>})</pre><p><strong>Step 11:</strong> Create a function called <strong><em>paginatedNewsArticles()</em></strong> which will accept the article model as a parameter. Inside the return statement, create three variables called <em>querypage</em>, <em>querylimit</em> and <em>paginatedArticlesList</em>. The <em>querypage</em> and <em>querylimit</em> will store the page and limit that will be passed from each URL query. The <em>paginatedArticlesList</em> will store all the paginated articles.</p><pre><em>function</em> paginatedNewsArticles(<em>model</em>) {</pre><pre>   return <em>async</em> (<em>request</em>, <em>response</em>, <em>next</em>) =&gt; {<br>     <em>const</em> querypage = parseInt(request.query.page)<br>     <em>const</em> querylimit = parseInt(request.query.limit)<br>}}</pre><p><strong>Step 12:</strong> Next add two if statements that will check the page number to determine the previous page and the next page. This information will be sent together with the <em>paginatedArticlesList</em> in the JSON response.</p><pre><em>const</em> firstIndex = (page - 1) * limit<br><em>const</em> lastIndex = page * limit</pre><pre>if (firstIndex &gt; 0) {<br>      paginatedArticlesList.previous = {<br>      previouspage: page - 1,<br>      limit: limit<br>    }<br>  }</pre><pre>if (lastIndex &lt; await model.countDocuments().exec()) {<br>      paginatedArticlesList.next = {<br>       nextpage: page + 1,<br>       limit: limit<br>     }</pre><pre>}</pre><p>The final <strong><em>index.js</em></strong> file will look like this.</p><pre><em>const</em> express = require(&#39;express&#39;)<br><em>const</em> newsapp = express()<br><em>const</em> mongoosedb = require(&#39;mongoose&#39;)<br><em>const</em> article = require(&#39;./articles&#39;)</pre><pre>mongoose.connect(&#39;mongodb://localhost/pagination&#39;, { useNewUrlParser: true, useUnifiedTopology: true })</pre><pre><em>const</em> db = mongoose.connection</pre><pre>db.on(&#39;error&#39;, console.error.bind(console, &#39;connection error:&#39;));<br>db.once(&#39;open&#39;, <em>async</em> () =&gt; {<br>  if (await article.countDocuments().exec() &gt; 0) return</pre><pre>Promise.all([</pre><pre>   article.create({ title: &#39;article 1&#39;, <br>                content: &quot;News content for article 1&quot; }),</pre><pre>   article.create({ title: &#39;article 2&#39;, <br>                content: &quot;News content for article 2&quot; }),</pre><pre>   article.create({ title: &#39;article 3&#39;, <br>                content: &quot;News content for article 3&quot; }),</pre><pre>   article.create({ title: &#39;article 4&#39;, <br>                content: &quot;News content for article 4&quot; }),</pre><pre>   article.create({ title: &#39;article 5&#39;, <br>                content: &quot;News content for article 5&quot; }),</pre><pre>   article.create({ title: &#39;article 6&#39;, <br>                content: &quot;News content for article 6&quot; }),</pre><pre>   article.create({ title: &#39;article 7&#39;, <br>                content: &quot;News content for article 7&quot; }),</pre><pre>   article.create({ title: &#39;article 8&#39;, <br>                content: &quot;News content for article 8&quot; }),</pre><pre>   article.create({ title: &#39;article 9&#39;, <br>                content: &quot;News content for article 9&quot; }),</pre><pre>   article.create({ title: &#39;article 10&#39;, <br>                 content: &quot;News content for article 10&quot; }),</pre><pre>   article.create({ title: &#39;article 11&#39;, <br>                content: &quot;News content for article 11&quot; }),</pre><pre>   article.create({ title: &#39;article 12&#39;, <br>                content: &quot;News content for article 12&quot; }),</pre><pre>   article.create({ title: &#39;article 13&#39;, <br>                content: &quot;News content for article 13&quot; })</pre><pre>]).then(() =&gt; console.log(&#39;Added Articles&#39;))</pre><pre>})</pre><pre>newsapp.get(&#39;/article&#39;, paginatedNewsArticles(article), (<em>request</em>, <em>response</em>) =&gt; {</pre><pre>response.json(response.paginatedResults)</pre><pre>})</pre><pre><em>function</em> paginatedNewsArticles(<em>model</em>) {</pre><pre>  return <em>async</em> (<em>request</em>, <em>response</em>, <em>next</em>) =&gt; {<br>    <em>const</em> querypage = parseInt(request.query.page)<br>    <em>const</em> querylimit = parseInt(request.query.limit)<br>    <em>const</em> firstIndex = (page - 1) * limit<br>    <em>const</em> lastIndex = page * limit</pre><pre>    <em>const</em> paginatedArticlesList = {}</pre><pre>   if (firstIndex &gt; 0) {<br>       paginatedArticlesList.previous = {<br>       previouspage: page - 1,<br>       limit: limit<br>     }<br>   }</pre><pre>   if (lastIndex &lt; await model.countDocuments().exec()) {<br>       paginatedArticlesList.next = {<br>       nextpage: page + 1,<br>       limit: limit<br>     }<br>}</pre><pre>try {<br>   paginatedArticlesList.results = await<br>   model.find().limit(limit).skip(firstIndex).exec()<br>   response.paginatedArticles = paginatedArticlesList<br>   next()<br>} catch (e) {<br>   response.status(500).json({ message: e.message })<br>}<br>}}</pre><pre>newsapp.listen(3000)</pre><p>Test the app</p><p>And there we have it. I hope you have found this useful. I will be back with more interesting articles. Thank you for reading.</p><p><em>More content at </em><a href="http://plainenglish.io/"><strong><em>plainenglish.io</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=58d31d6b9e2a" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/how-to-build-api-data-pagination-using-node-express-58d31d6b9e2a">How to Build API Data Pagination Using Node Express</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Build a Multi-Step Form Using Vue.js]]></title>
            <link>https://javascript.plainenglish.io/how-to-build-a-multi-step-form-using-vue-js-d00efc5f05f4?source=rss-93bfe6f45e07------2</link>
            <guid isPermaLink="false">https://medium.com/p/d00efc5f05f4</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Paul Nasilele]]></dc:creator>
            <pubDate>Wed, 04 Aug 2021 06:24:07 GMT</pubDate>
            <atom:updated>2021-08-04T10:35:27.303Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*GVsKNW62SOtInnHRjo1ahw.png" /><figcaption>Image by <a href="https://themaverickspirit.com/create-multi-step-form-wordpress/">The Maverick spirit</a></figcaption></figure><p>Online registration forms usually consist of long lists of fields for the user to enter. Dividing the long forms into smaller sections makes them more readable. This results in what is called a multi-step form. Such forms improve the user experience. Building multi-step forms have proven to be difficult for a lot of frontend developers.</p><p>In this article, I will show you step-by-step how to build such forms using Vue.js.</p><p><strong>Step 1:</strong> Create a new Vue project called MultiStepForm. Read the Vue Project setup <a href="https://cli.vuejs.org/guide/creating-a-project.html">here</a>.</p><pre>vue create MultiStepForm</pre><p><strong>Step 2:</strong> In the components folder, create a Vue component and name it <em>Multiform.vue</em>. Divide it into three parts, template, scripts, and styles.</p><pre>&lt;template&gt;&lt;/template&gt;</pre><pre>&lt;script&gt;&lt;/script&gt;</pre><pre>&lt;style&gt;&lt;/style&gt;</pre><p><strong>Step 3:</strong> Inside the template tags, create an <em>&lt;article/&gt;</em> tag inside a <em>&lt;div/&gt;</em> tag. Inside the <em>&lt;article/&gt;</em> tag add a <em>&lt;header/&gt;</em> tag and <em>&lt;section/&gt;</em> tag.</p><pre>&lt;template&gt;</pre><pre> &lt;div&gt;<br>  &lt;article&gt;<br>    &lt;header&gt;&lt;/header&gt;</pre><pre>    &lt;section&gt;&lt;/section&gt;<br>   &lt;/article&gt;<br> &lt;/div&gt;</pre><pre>&lt;/template&gt;</pre><p><strong>Step 4:</strong> Inside the header section add a <em>&lt;div&gt;</em> tag and using v-bind add a dynamic class. This CSS class will depend on the position of the form.</p><p>Then using the v-for, loop through the <em>formGroup</em> array. This <em>formGroup</em> will be defined later in the script section.</p><pre>&lt;header&gt;<br>     <br>     &lt;div<br>       :<em>class</em>=&quot;{&#39;active&#39;:index === formPosition}&quot;<br>       <em>v-for</em>=&quot;(step, index) in formGroup&quot;<br>       :<em>key</em>=&quot;&#39;step&#39;+index&quot;<br>     &gt;<br>       {{ index + 1 }}<br>     &lt;/div&gt;<br>     <br>&lt;/header&gt;</pre><p><strong>Step 5:</strong> In the <em>&lt;section&gt;</em> tag add a dynamic class using v-bind. Then, using the v-for directive, loop through the <em>formGroup</em> fields.</p><pre>&lt;section :<em>class</em>=&quot;animation&quot;&gt;<br>     &lt;h2&gt;{{ formGroup[formPosition].title }}&lt;/h2&gt;<br>     &lt;div&gt;<br>     &lt;div<br>       <em>v-for</em>=&quot;(field, index) in formGroup[formPosition].fields&quot;<br>       :<em>key</em>=&quot;&#39;field&#39;+index&quot;<br>     &gt;</pre><pre>   &lt;input <em>type</em>=&quot;text&quot; <em>v-model</em>=&quot;field.value&quot;  <em>required</em>&gt;<br>      &lt;label&gt;{{ field.label }}&lt;/label&gt;<br>     &lt;/div&gt;<br>     &lt;/div&gt;<br>   &lt;div&gt;</pre><pre>&lt;/div&gt;<br>   &lt;/div&gt;</pre><pre>&lt;/section&gt;</pre><p><strong>Step 6:</strong> Below the input tag, add two buttons. These buttons will be conditionally displayed depending on <em>formPosition</em>. The v-if directive will be used to achieve this.</p><pre>&lt;section :<em>class</em>=&quot;animation&quot;&gt;<br>     &lt;h2&gt;{{ formGroup[formPosition].title }}&lt;/h2&gt;<br>     &lt;div&gt;<br>     &lt;div<br>       <em>v-for</em>=&quot;(field, index) in formGroup[formPosition].fields&quot;<br>       :<em>key</em>=&quot;&#39;field&#39;+index&quot;<br>     &gt;</pre><pre>&lt;input <em>type</em>=&quot;text&quot; <em>v-model</em>=&quot;field.value&quot;  <em>required</em>&gt;<br>      &lt;label&gt;{{ field.label }}&lt;/label&gt;<br>     &lt;/div&gt;<br>     &lt;/div&gt;<br>   &lt;div&gt;</pre><pre>&lt;button <br>     <em>v-if</em>=&quot;formPosition +1 &lt; formGroup.length -1&quot;      @<em>click</em>=&quot;nextStep&quot;&gt;<br>     Next<br>   &lt;/button&gt;</pre><pre>&lt;button <br>     <em>v-if</em>=&quot;formPosition +1 === formGroup.length -1&quot;&gt;<br>    Enter<br>   &lt;/button&gt;</pre><pre>&lt;/div&gt;<br>   &lt;/div&gt;</pre><pre>&lt;/section&gt;</pre><p>The final template section will look like this below.</p><pre>&lt;template&gt;<br> &lt;div&gt;<br>  &lt;article&gt;<br>    &lt;header&gt;<br>     <br>     &lt;div<br>       :<em>class</em>=&quot;{&#39;active&#39;:index === formPosition}&quot;<br>       <em>v-for</em>=&quot;(step, index) in formGroup&quot;<br>       :<em>key</em>=&quot;&#39;step&#39;+index&quot;<br>     &gt;<br>       {{ index + 1 }}<br>     &lt;/div&gt;<br>     <br>    &lt;/header&gt;</pre><pre>&lt;section :<em>class</em>=&quot;animation&quot;&gt;<br>     &lt;h2&gt;{{ formGroup[formPosition].title }}&lt;/h2&gt;<br>     &lt;div&gt;<br>     &lt;div<br>       <em>v-for</em>=&quot;(field, index) in formGroup[formPosition].fields&quot;<br>       :<em>key</em>=&quot;&#39;field&#39;+index&quot;<br>     &gt;</pre><pre>&lt;input <em>type</em>=&quot;text&quot; <em>v-model</em>=&quot;field.value&quot;  <em>required</em>&gt;<br>      &lt;label&gt;{{ field.label }}&lt;/label&gt;<br>     &lt;/div&gt;<br>     &lt;/div&gt;<br>   &lt;div&gt;</pre><pre>&lt;button <br>     <em>v-if</em>=&quot;formPosition +1 &lt; formGroup.length -1&quot;      @<em>click</em>=&quot;nextStep&quot;&gt;<br>     Next<br>   &lt;/button&gt;</pre><pre>&lt;button <br>     <em>v-if</em>=&quot;formPosition +1 === formGroup.length -1&quot;&gt;<br>    Enter<br>   &lt;/button&gt;</pre><pre>&lt;/div&gt;<br>   &lt;/div&gt;</pre><pre>&lt;/section&gt;<br>   &lt;/article&gt;<br>   &lt;/div&gt;</pre><pre>&lt;/template&gt;</pre><p><strong>Step 7:</strong> In the <em>&lt;script&gt;</em> tag add two properties to the data object. The first one is <em>formPosition</em> which will be incremented each time the <em>Next</em> button is clicked.</p><p>The second one will be the <em>animation</em> which will store the CSS class name.</p><pre>&lt;script&gt;<br>  export default {<br>  data: () =&gt; {<br>    return {<br>             formPosition: 0,<br>             animation: &#39;animate-in&#39;,<br>             </pre><pre>  }}}</pre><pre>&lt;/script&gt;</pre><p><strong>Step 7:</strong> Next, add another property called <em>formGroup</em> which will hold the data to display on the form fields as it transitions.</p><pre>&lt;script&gt;<br>  export default {<br>  data: () =&gt; {<br>    return {<br>             formPosition: 0,<br>             animation: &#39;animate-in&#39;,<br>             formGroup: [<br>               {title: &quot;Personal Details&quot;,<br>                 fields: [<br>                   {label: &quot;First Name&quot;, value: &quot;&quot; },<br>                   {label: &quot;Second Name&quot;, value: &quot;&quot;},<br>                   {label: &quot;Age&quot;, value: &quot;&quot;},]},<br>               {title: &quot;Address&quot;,<br>                 fields: [<br>                   {label: &quot;City&quot;, value: &quot;&quot;},<br>                   {label: &quot;Zip Code&quot;, value: &quot;&quot;},<br>                   {label: &quot;County&quot;, value: &quot;&quot;},<br>                   {label: &quot;State&quot;, value: &quot;&quot;},]},<br>               {title: &quot;Academic Details&quot;,<br>                 fields: [<br>                   {label: &quot;Academic qualification&quot;, value: &quot;&quot;},<br>                   {label: &quot;College Attended&quot;, value: &quot;&quot;},<br>                   {label: &quot;Year of completion&quot;, value: &quot;&quot;},]},<br>                ]}},</pre><pre>methods: {<br>     nextStep(){<br>      <em>this</em>.animation = &#39;animate-out&#39;;<br>      setTimeout(() =&gt; {<br>      <em>this</em>.animation = &#39;animate-in&#39;;<br>      <em>this</em>.formPosition += 1;<br>     }, 600);<br>     },}</pre><pre>&lt;/script&gt;</pre><p><strong>Step 8:</strong> Next, add a method that that will change the CSS class name to display the next form group.</p><pre>methods: {<br>     nextStep(){<br>      <em>this</em>.animation = &#39;animate-out&#39;;<br>      setTimeout(() =&gt; {<br>      <em>this</em>.animation = &#39;animate-in&#39;;<br>      <em>this</em>.formPosition += 1;<br>     }, 600);<br>     },}}</pre><p>Next, add the CSS styles.</p><pre>&lt;style&gt;</pre><pre><em>.animation-in</em> {<br>   transform-origin: left;<br>   animation: in .6s ease-in-out;<br>}<br><em>.animation-out</em> {<br>   transform-origin: bottom left;<br>   animation: out .6s ease-in-out;<br>}</pre><pre>&lt;/style&gt;</pre><p>The final <strong><em>Multiform.vue</em></strong> component must look like this below.</p><pre>&lt;template&gt;<br> &lt;div&gt;<br>  &lt;article&gt;<br>    &lt;header&gt;<br>     <br>     &lt;div<br>       :<em>class</em>=&quot;{&#39;active&#39;:index === formPosition}&quot;<br>       <em>v-for</em>=&quot;(step, index) in formGroup&quot;<br>       :<em>key</em>=&quot;&#39;step&#39;+index&quot;<br>     &gt;<br>       {{ index + 1 }}<br>     &lt;/div&gt;<br>     <br>    &lt;/header&gt;</pre><pre>    &lt;section :<em>class</em>=&quot;animation&quot;&gt;<br>     &lt;h2&gt;{{ formGroup[formPosition].title }}&lt;/h2&gt;<br>     &lt;div&gt;<br>     &lt;div<br>       <em>v-for</em>=&quot;(field, index) in formGroup[formPosition].fields&quot;<br>       :<em>key</em>=&quot;&#39;field&#39;+index&quot;<br>     &gt;</pre><pre><br>      &lt;input <em>type</em>=&quot;text&quot; <em>v-model</em>=&quot;field.value&quot;  <em>required</em>&gt;<br>      &lt;label&gt;{{ field.label }}&lt;/label&gt;<br>     &lt;/div&gt;<br>     &lt;/div&gt;<br>   &lt;div&gt;</pre><pre>   &lt;button <br>     <em>v-if</em>=&quot;formPosition +1 &lt; formGroup.length -1&quot;      @<em>click</em>=&quot;nextStep&quot;&gt;<br>     Next<br>   &lt;/button&gt;</pre><pre>   &lt;button <br>     <em>v-if</em>=&quot;formPosition +1 === formGroup.length -1&quot;&gt;<br>    Enter<br>   &lt;/button&gt;</pre><pre><br>   &lt;/div&gt;<br>   &lt;/div&gt;</pre><pre>   &lt;/section&gt;<br>   &lt;/article&gt;<br>   &lt;/div&gt;</pre><pre>&lt;/template&gt;</pre><pre>&lt;script&gt;<br>  export default {<br>  data: () =&gt; {<br>    return {<br>             formPosition: 0,<br>             animation: &#39;animate-in&#39;,<br>             formGroup: [<br>               {title: &quot;Personal Details&quot;,<br>                 fields: [<br>                   {label: &quot;First Name&quot;, value: &quot;&quot; },<br>                   {label: &quot;Second Name&quot;, value: &quot;&quot;},<br>                   {label: &quot;Age&quot;, value: &quot;&quot;},]},<br>               {title: &quot;Address&quot;,<br>                 fields: [<br>                   {label: &quot;City&quot;, value: &quot;&quot;},<br>                   {label: &quot;Zip Code&quot;, value: &quot;&quot;},<br>                   {label: &quot;County&quot;, value: &quot;&quot;},<br>                   {label: &quot;State&quot;, value: &quot;&quot;},]},<br>               {title: &quot;Academic Details&quot;,<br>                 fields: [<br>                   {label: &quot;Academic qualification&quot;, value: &quot;&quot;},<br>                   {label: &quot;College Attended&quot;, value: &quot;&quot;},<br>                   {label: &quot;Year of completion&quot;, value: &quot;&quot;},]},<br>                ]}},</pre><pre>  methods: {<br>     nextStep(){<br>      <em>this</em>.animation = &#39;animate-out&#39;;<br>      setTimeout(() =&gt; {<br>      <em>this</em>.animation = &#39;animate-in&#39;;<br>      <em>this</em>.formPosition += 1;<br>     }, 600);<br>     },}}</pre><pre>&lt;/script&gt;</pre><pre>&lt;style&gt;</pre><pre><em>.animation-in</em> {<br>   transform-origin: left;<br>   animation: in .6s ease-in-out;<br>}<br><em>.animation-out</em> {<br>   transform-origin: bottom left;<br>   animation: out .6s ease-in-out;<br>}</pre><pre>&lt;/style&gt;</pre><p><strong>Step 10:</strong> Lastly import the <strong><em>MultiForm.vue</em></strong> component into the <strong><em>App.vue.</em></strong></p><pre>&lt;template&gt;<br>  &lt;div&gt;<br>   &lt;MultiForm/&gt;<br>  &lt;/div&gt;<br>&lt;/template&gt;</pre><pre>&lt;script&gt;</pre><pre>import MultiForm from &#39;./components/MultiForm.vue&#39;</pre><pre>export default {<br>   name: &#39;App&#39;,<br>   components: {<br>     MultiForm<br> }<br>}</pre><pre>&lt;script/&gt;</pre><pre>&lt;style&gt;&lt;/style&gt;</pre><p>Run the app</p><p>And there we have it. I hope you have found this useful. I will be back with more interesting articles. Thank you for reading.</p><p><em>More content at </em><a href="http://plainenglish.io/"><strong><em>plainenglish.io</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d00efc5f05f4" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/how-to-build-a-multi-step-form-using-vue-js-d00efc5f05f4">How to Build a Multi-Step Form Using Vue.js</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Build Image Size Validation using Vanilla JavaScript]]></title>
            <link>https://javascript.plainenglish.io/how-to-build-image-size-validation-using-vanilla-js-da1fc6b258b?source=rss-93bfe6f45e07------2</link>
            <guid isPermaLink="false">https://medium.com/p/da1fc6b258b</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Paul Nasilele]]></dc:creator>
            <pubDate>Wed, 28 Jul 2021 07:11:56 GMT</pubDate>
            <atom:updated>2021-07-29T09:14:54.741Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JvVh2zmVweR2-cKG" /><figcaption>Photo by <a href="https://unsplash.com/@kobuagency?utm_source=medium&amp;utm_medium=referral">KOBU Agency</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Web developers can use <strong>vanilla JavaScript</strong><em> </em>to build a variety of features. Using vanilla JavaScript can speed up the development process in web programming. This is because there are no external libraries and plugins required. For example, vanilla JS provides methods that can be used to put in place image size validation on websites. These methods are embedded in the JavaScript engine. In this article, I will show you step by step how to validate images using vanilla JavaScript.</p><p><strong>Step 1:</strong> Create a folder and inside it create three files. These are <strong><em>index.html</em></strong>, <strong><em>styles.css</em></strong><em>,</em> and <strong><em>script.js</em></strong><em>.</em></p><p><strong>Step 2:</strong> Add the HTML boilerplate code and then add the Image upload title between the &lt;title&gt; tags.</p><pre>&lt;!DOCTYPE <em>html</em>&gt;<br>&lt;html <em>lang</em>=&quot;en&quot;&gt;<br>&lt;head&gt;<br> &lt;meta <em>charset</em>=&quot;UTF-8&quot;&gt;<br> &lt;meta <em>http-equiv</em>=&quot;X-UA-Compatible&quot; <em>content</em>=&quot;IE=edge&quot;&gt;<br> &lt;meta <em>name</em>=&quot;viewport&quot; <em>content</em>=&quot;width=device-width, initial-scale=1.0&quot;&gt;</pre><pre>&lt;title&gt;Image Upload&lt;/title&gt;</pre><pre>&lt;/head&gt;</pre><pre>&lt;body&gt;&lt;/body&gt;</pre><pre>&lt;/html&gt;</pre><p><strong>Step 3:</strong> Link the <em>styles.css</em> file and the <em>script.js</em> file to the head section of the <em>index.html.</em></p><pre>&lt;link <em>rel</em>=&quot;stylesheet&quot; <em>href</em>=&quot;styles.css&quot;&gt;<br>&lt;script <em>src</em>=&quot;script.js&quot;&gt;&lt;/script&gt;</pre><p><strong>Step 4:</strong> Create a <strong><em>div</em></strong> tag with a class called container inside the body section of the <em>index.html.</em></p><pre>&lt;body&gt;<br>  &lt;div <em>class</em>=&quot;container&quot;&gt;<br>  &lt;/div&gt;<br>&lt;/body&gt;</pre><p><strong>Step 5:</strong> Add <strong><em>label</em></strong>, <strong><em>input</em></strong>, and <strong><em>span</em></strong> tag inside the container.</p><pre>&lt;body&gt;<br> &lt;div <em>class</em>=&quot;container&quot;&gt;<br>  &lt;label <em>for</em>=&quot;imageuploadbutton&quot; class=&quot;label&quot;&gt;Upload Image Here&lt;/label&gt;<br>  &lt;input  <em>type</em>=&quot;file&quot; id=&quot;imageuploadbutton&quot; &gt;<br>  &lt;span class=&quot;validation-message&quot; &gt;&lt;/span&gt;<br> &lt;/div&gt;<br>&lt;/body&gt;</pre><p>The final <strong><em>index.html</em></strong> file should look like this</p><pre>&lt;!DOCTYPE <em>html</em>&gt;<br>&lt;html <em>lang</em>=&quot;en&quot;&gt;<br>&lt;head&gt;<br> &lt;meta <em>charset</em>=&quot;UTF-8&quot;&gt;<br> &lt;meta <em>http-equiv</em>=&quot;X-UA-Compatible&quot; <em>content</em>=&quot;IE=edge&quot;&gt;<br> &lt;meta <em>name</em>=&quot;viewport&quot; <em>content</em>=&quot;width=device-width, initial-scale=1.0&quot;&gt;</pre><pre>&lt;title&gt;Image Upload&lt;/title&gt;<br>&lt;link <em>rel</em>=&quot;stylesheet&quot; <em>href</em>=&quot;styles.css&quot;&gt;<br>&lt;script <em>src</em>=&quot;script.js&quot;&gt;&lt;/script&gt;</pre><pre>&lt;/head&gt;</pre><pre>&lt;body&gt;<br> &lt;div <em>class</em>=&quot;container&quot;&gt;<br>  &lt;label <em>for</em>=&quot;imageuploadbutton&quot; class=&quot;label&quot;&gt;Upload Image Here&lt;/label&gt;<br>  &lt;input  <em>type</em>=&quot;file&quot; id=&quot;imageuploadbutton&quot; &gt;<br>  &lt;span class=&quot;validation-message&quot; &gt;&lt;/span&gt;<br> &lt;/div&gt;<br>&lt;/body&gt;</pre><pre>&lt;/html&gt;</pre><p><strong>Step 6: </strong>In the <strong><em>style.css</em></strong>, add <em>container</em>, <em>label</em>, and <em>validation-message</em> class styles.</p><pre><em>.container</em>{<br>   padding-left: 30px;<br>   padding-right: 30px;<br>   padding-top: 15px;<br>   padding-bottom: 15px;<br>   display: flex;<br>   flex-direction: column;<br>   align-items: center;</pre><pre>}</pre><pre><em>.label</em> {<br>   color: navy;<br>   font-size: larger;<br>   font-weight: bold;<br>}</pre><pre><em>.validation-message</em>{<br>   color: crimson;<br>   font-size: smaller;<br>   font-weight: normal;<br>}</pre><p><strong>Step 7:</strong> Now in the <strong><em>script.js</em></strong> create two variables called input and span. These will hold the HTML input and span tags.</p><pre><em>let</em> input = document.querySelector(&#39;input&#39;);<br><em>let</em> span = document.querySelector(&#39;span&#39;);</pre><p><strong>Step 8:</strong> Create an event listener in the input variable that will respond to file uploads.</p><pre><em>let</em> input = document.querySelector(&#39;input&#39;);</pre><pre><em>let</em> span = document.querySelector(&#39;span&#39;);</pre><pre>input.addEventListener(&#39;&#39;, () =&gt; {})</pre><p><strong>Step 9:</strong> Inside the <strong><em>addEventlistener</em></strong> return statement, create a variable called <em>files</em> and an if statement to check the length of the <em>files</em> variable. This variable will hold any files that are uploaded.</p><pre>input.addEventListener(&#39;change&#39;, () =&gt; {</pre><pre><em>let</em> files = input.files;</pre><pre>if (files.length &gt; 0) {}</pre><pre>span.innerText = &#39;&#39;;</pre><pre>})</pre><p><strong>Step 10:</strong> Inside the if statement, add another if statement that will validate the file type</p><pre>input.addEventListener(&#39;change&#39;, () =&gt; {</pre><pre><em>let</em> files = input.files;</pre><pre>if (files.length &gt; 0) {</pre><pre>  if (files[0].type != &#39;jpeg&#39; || files[0].type != &#39;png&#39; ) {<br>   span.innerText = &#39;File Type must be jpeg or png&#39;;<br>   return;<br>  }</pre><pre>}</pre><pre>span.innerText = &#39;&#39;;</pre><pre>})</pre><p><strong>Step 11:</strong> Next add another if statement that will now validate the image size</p><pre>input.addEventListener(&#39;change&#39;, () =&gt; {</pre><pre><em>let</em> files = input.files;</pre><pre>if (files.length &gt; 0) {</pre><pre>  if (files[0].type != &#39;jpeg&#39; || files[0].type != &#39;png&#39; ) {<br>   span.innerText = &#39;File Type must be jpeg or png&#39;;<br>   return;<br>  }</pre><pre>  if (files[0].size &gt; 500 * 1024) {<br>   span.innerText = &#39;File Size Exceeds 500kb&#39;;<br>   return;<br>  }<br>}</pre><pre>span.innerText = &#39;&#39;;</pre><pre>})</pre><p>The final <strong><em>script.js</em></strong> file should look like this.</p><pre><em>let</em> input = document.querySelector(&#39;input&#39;);<br><em>let</em> span = document.querySelector(&#39;span&#39;);</pre><pre>input.addEventListener(&#39;change&#39;, () =&gt; {<br> <em>let</em> files = input.files;<br>  if (files.length &gt; 0) {<br>   if (files[0].type != &#39;jpeg&#39; || files[0].type != &#39;png&#39; )            {span.innerText = &#39;File Type must be jpeg or png&#39;;</pre><pre>return;</pre><pre>}</pre><pre> if (files[0].size &gt; 500 * 1024) {</pre><pre>   span.innerText = &#39;File Size Exceeds 500kb&#39;;</pre><pre>   return;</pre><pre>}</pre><pre>}</pre><pre>span.innerText = &#39;&#39;;</pre><pre>})</pre><p>Open the index file in a browser to run everything.</p><h4><strong>Conclusion</strong></h4><p>And there we have it. I hope you have found this useful. I will be back with more interesting articles. Thank you for reading.</p><p>Go to <a href="https://developer.mozilla.org/en-US/docs/Web/API/File/Using_files_from_web_applications"><strong>Mozilla Developer</strong></a><strong> </strong>for more information on this.</p><p><em>More content at </em><a href="http://plainenglish.io/"><strong><em>plainenglish.io</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da1fc6b258b" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/how-to-build-image-size-validation-using-vanilla-js-da1fc6b258b">How to Build Image Size Validation using Vanilla JavaScript</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>